maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   When to change MAC using an Upstart script (https://talk.maemo.org/showthread.php?t=93812)

marmistrz 2014-09-04 19:05

When to change MAC using an Upstart script
 
I created a simple upstart script:

Code:

start on started wl1251-cal
stop on starting shutdown
console none

script
    exec macchanger (params)
end-script

Even though, after a full bootup, the mac address stays the same. I used wl1251-cal because it is said to be the last, according to the wiki. [1]

Btw. why does setting `console log` makes upstart not accept the script (unknown job)

[1] http://wiki.maemo.org/Maemo_5_boot_process

peterleinchen 2014-09-04 19:54

Re: When to change MAC using an Upstart script
 
First:
What about exec rights of script?
Second:
it is not end-script but end script
Third:
you do not need exec and script block
single command via exec
multi commands via script ... end script

Just put a simple
echo $(date) >> /log.log
and maybe a to be tuned
sleep 10
before
macchanger (params)
for debugging ...

wicket 2014-09-05 04:52

Re: When to change MAC using an Upstart script
 
Is there a particular reason for why you need to change the MAC address with a script?

I've not tried it (on Maemo) but it should be possible to configure the MAC address directly in the /etc/network/interfaces file using the hwaddress option.

marmistrz 2014-09-07 12:28

Re: When to change MAC using an Upstart script
 
@peterleinchen: yes, it's end script, I wrote it from memory, permission 0755, owner - root.

@wicket: Always changed it with macchanger and there was written somewhere, that to permanently change address, you should make an upstart script.

I'll try moving to pure exec for curiosity's sake, but I think I'll use wicket's suggestion.

pali 2014-09-07 19:10

Re: When to change MAC using an Upstart script
 
Here are commands how to change mac address only with standard linux tools which are installed everywhere now:

Code:

$ ip link set dev "$interface" down
$ ip link set dev "$interface" address "$mac_address"
$ ip link set dev "$interface" up

or

Code:

$ ifconfig "$interface" down
$ ifconfig "$interface" hw ether "$mac_address"
$ ifconfig "$interface" up


marmistrz 2014-09-11 19:17

Re: When to change MAC using an Upstart script
 
Will adding
Code:

auto wlan0
iface wlan0 inet dhcp
      hwadresss ether xx:xx:xx:xx:xx:xx

to /etc/network/interfaces do the trick?

wicket 2014-09-12 05:38

Re: When to change MAC using an Upstart script
 
Quote:

Originally Posted by marmistrz (Post 1438936)
Will adding
Code:

auto wlan0
iface wlan0 inet dhcp
      hwadresss ether xx:xx:xx:xx:xx:xx

to /etc/network/interfaces do the trick?

Almost. Try it without the word "ether". I've had this working under Debian on the N900.

reinob 2014-09-12 08:54

Re: When to change MAC using an Upstart script
 
Quote:

Originally Posted by marmistrz (Post 1438249)
I used wl1251-cal because it is said to be the last, according to the wiki. [1]

Besides the other comments you've received, I just wanted to note that wl1251-cal is only executed if the state is TEST, which is (basically) never the case.

You need to follow the "USER" path. You could use e.g. "hildon-desktop" or "wlancond" or "icd2" as trigger.

marmistrz 2014-09-29 18:08

Re: When to change MAC using an Upstart script
 
I had no time to post the results ;)

My /etc/network/interfaces is

Code:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto usb0
iface usb0 inet static
        address 192.168.2.15
        netmask 255.255.255.0
        gateway 192.168.2.14
               
auto wlan0
iface wlan0 inet dhcp
        hwaddress xx:xx:xx:xx:xx:xx

But after booting up the MAC adress is stock...

pali 2014-09-29 18:10

Re: When to change MAC using an Upstart script
 
Maemo does not use /etc/network/interfaces for wifi configuration, so that file is basically ignored.


All times are GMT. The time now is 19:41.

vBulletin® Version 3.8.8