Gabor Juhos
b7914344ad
base-files: add macaddr_canonicalize helper function
...
In commit r38690, the MAC address canonicalization
has been converted to use 'tr' instead of 'printf'.
This only works if with MAC addresses which uses
the 'xx:xx:xx:xx:xx:xx' format.
However on some boards, the MAC addresses are stored
in different format in the mtd partition. Some vendors
are using hyphens or dots as separators instead of
colons. Also the leading zeroes may be missing from the
individual octets or those are replaced with spaces.
Add a new function which can be used to convert these
into the 'xx:xx:xx:xx:xx:xx' format. Also update the
'mtd_get_mac_ascii' function to use the new helper.
The helper function is based on this code:
http://isquared.nl/blog/2010/08/11/Bash-function-to-canonicalize-MAC-addresses/
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 38803
11 years ago
Gabor Juhos
23cf426324
base-files: mtd_get_mac_ascii bugfix
...
The mtd_get_mac_ascii utility function was broken. This fixes it.
- Remove the superfluous include of /lib/functions.sh. The
function is already in that file so it is pointless,
- only use a variable if the whole key word matches,
- don't try to process the MAC address if it is empty,
- use 'tr' to canonicalize the MAC address,
Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
[juhosg: add more fixes, update commit message]
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 38690
11 years ago
Gabor Juhos
8d55ea10ad
base-files: add mtd_get_part_size helper
...
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 37475
11 years ago
John Crispin
43a3d87b83
package: fix insmod on install
...
the procd changes broke the postinst insmod.
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 37015
12 years ago
John Crispin
4c43cacce0
base-files: module loading is now handled by ubox/kmodloader
...
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 37003
12 years ago
Gabor Juhos
c4f14fab9b
base-files: minor cosmetic corrections for functions.sh
...
- update copyright header
- remove superfluous shebang left-over from changeset 34794
- unify function declaration
[juhosg: keep Vertical Communications' copyright notice]
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 35646
12 years ago
Gabor Juhos
5a8c63b47e
base-files: add macaddr_{add,2bin,setbit_la} helpers
...
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 35614
12 years ago
Gabor Juhos
70d40b2ddd
base-files: add mtd_get_mac_{ascii,binary} helpers
...
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 35612
12 years ago
Steven Barth
f657787b52
base-files: Fix a typo in config_list_foreach
...
SVN-Revision: 34893
12 years ago
Mirko Vogt
4d4b2d3ced
merge /lib/functions/boot.sh and /lib/functions.sh
...
SVN-Revision: 34794
12 years ago
Mirko Vogt
439a869090
Do not overload mount-call - trying to reduce confusion
...
The behaviour of calling 'mount' differed depending on whether it called
the busybox-mount, the mount of util-linux, the mount defined in
/lib/functions.sh and /lib/functions/boot.sh
/etc/preinit even included /lib/functions.sh and /lib/functions/boot.sh,
both re-defining 'mount'.
SVN-Revision: 34792
12 years ago
Gabor Juhos
1552af3131
base-files: add mtd_find_chardev helper
...
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 34648
12 years ago
Mirko Vogt
ee17703371
Revert "remove function find_mtd_part() from /lib/functions.sh"
...
Reverting commit 34641.
Function find_mtd_part() is needed by some scripts deployed
for certain targets but not including boot.sh after all.
Still, all this certainly needs some love.
SVN-Revision: 34642
12 years ago
Mirko Vogt
1521cdda0f
remove function find_mtd_part() from /lib/functions.sh
...
Since all scripts using this function include /lib/functions/boot.sh -
where this function is defined as well - it can be dropped
from /lib/functions.sh. Also avoids further confusion about this
function being declared and defined in two different places.
SVN-Revision: 34641
12 years ago
Jo-Philipp Wich
a044a43d06
base-files: make user_add() populate the shadow db as well
...
SVN-Revision: 32063
13 years ago
Felix Fietkau
3678ba60ca
base-files: rename internal variables in config_foreach to make namespace conflicts more unlikely
...
SVN-Revision: 31431
13 years ago
Felix Fietkau
6f46704743
base-files: split service related functions off to /lib/functions/service.sh
...
SVN-Revision: 31042
13 years ago
Gabor Juhos
8ae051799a
base-files: remove trailing whitespaces from lib/functions.sh
...
SVN-Revision: 30775
13 years ago
Nicolas Thill
b49aed1520
package/base-files: enhance service functions
...
* allow matching process by name (useful for processes changing it)
* check if first argument is executable
* fix function name used in error messages
SVN-Revision: 28991
13 years ago
Nicolas Thill
f371d516bf
package/base-files: /lib/functions.sh: add {group,user}_{add,exists} functions
...
SVN-Revision: 28871
13 years ago
Nicolas Thill
62a2827ea7
package/base-files: /lib/functions.sh: let service_stop exit early if no matching process to stop where found
...
SVN-Revision: 28870
13 years ago
Nicolas Thill
b7b56df707
package/base-files: enhance & cleanup service wrappers
...
* add service_check function for checking if a process is alive
* add service_signal for sending arbitrary signals to a process
* change service_stop to send a TERM signal first, wait for the process to die and send a KILL signal if it doen't
* have service_kill print a warning on STDERR stating it has been deprecated
SVN-Revision: 28865
13 years ago
Nicolas Thill
d0659ce37e
package/base-files: move service* functions from /etc/rc.common to /lib/functions.sh
...
SVN-Revision: 28864
13 years ago
Nicolas Thill
b6aef59ea8
package/base-files: move /etc/functions.sh to /lib/functions.sh
...
SVN-Revision: 28857
13 years ago
Daniel Dickinson
d5542b4f59
block-mount base-files: Added additional check to pi_include to ensure that a directory used with pi_include actually contains files matching the souring pattern because if not the shell dies due to an empty string in for statement. Added /lib/functions/fsck as an empty dir to block-mount. This combination fixes a warning which generates a lot of bug reports, without panicking the kernel like the last attempt.
...
SVN-Revision: 26479
14 years ago
Daniel Dickinson
18b473ca9b
base/block-extroot, base/block-mount: Modified preinit and block-extroot and block-mount so that use of block-mount and block-extroot do not require that block-extroot, block-mount, nor the kernel modules they depend, on are required to included in the image. That is block-extroot and dependencies may now be installed as modules onto the jffs2 part of a squashfs system and it will work. In addition packages which are installed into the jffs2 of a squashfs system may now affect preinit, so long as they do not require execution of commands that occur before the merging of the jffs2 and built-in (squashfs) preinit scripts is done.
...
Thanks jow for the preinit merge stuff!
SVN-Revision: 23110
14 years ago
Jo-Philipp Wich
4815de3f26
base-files: introduce service_kill() into functions.sh - a convenience wrapper for killing services by pid or pidfile with a grace period for termination before kill
...
SVN-Revision: 23087
14 years ago
Jo-Philipp Wich
63991ba875
base-files, uci: properly revert list state on config_load This fixes a bug where lists end up with duplicate values if config_load was invoked multiple times.
...
SVN-Revision: 22629
14 years ago
Felix Fietkau
91a8f2334a
add missing argument to debug/mount wrappers (thx, matteo)
...
SVN-Revision: 18718
15 years ago
Felix Fietkau
889532d1fd
do not start multiple subshells for applying /etc/uci-defaults. use sh -x for hush compatibility
...
SVN-Revision: 18717
15 years ago
Felix Fietkau
f1649982e2
functions.sh: use functions instead of aliases for the debug, mount wrappers - hush does not have aliases
...
SVN-Revision: 18715
15 years ago
Felix Fietkau
387b221aa1
base-files: port functions.sh to new config_get
...
Signed-off-by: Malte S. Stretz <mss@apache.org>
SVN-Revision: 17156
15 years ago
Felix Fietkau
4dbaccf0cd
base-files: allow default value for config_get
...
Signed-off-by: Malte S. Stretz <mss@apache.org>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 17155
15 years ago
Florian Fainelli
1673462564
Use busybox mount, could be overriden to use util-linux-ng for instance, thanks sn9
...
SVN-Revision: 12386
16 years ago
Felix Fietkau
8a08f95e42
upgrade to uci 0.5.0, adds list handling support
...
SVN-Revision: 12353
16 years ago
Felix Fietkau
6a4edcadc1
fix config_clear(), see #3054
...
SVN-Revision: 12036
17 years ago
Felix Fietkau
8c453b693c
functions.sh: add list_contains function for checking whether a list contains a specific element
...
SVN-Revision: 12025
17 years ago
Felix Fietkau
4d883da9bf
functions.sh: add a function for removing an item from a list in a shell variable
...
SVN-Revision: 12024
17 years ago
Felix Fietkau
49080689d9
add an extra safety check
...
SVN-Revision: 10389
17 years ago
Felix Fietkau
0cf1a58282
Here comes the new UCI. Enjoy :)
...
SVN-Revision: 10367
17 years ago
Felix Fietkau
3b2e07b84f
add uci_set_default (to be used in init scripts or /etc/uci-defaults)
...
SVN-Revision: 10086
17 years ago
Felix Fietkau
8977c6c20a
drop the '0' default in config_get_bool
...
SVN-Revision: 9618
17 years ago
Felix Fietkau
6b882b579f
support true and false in config_get_bool
...
SVN-Revision: 8840
17 years ago
Felix Fietkau
6330c58b58
add patch from #2111
...
SVN-Revision: 8106
18 years ago
Mike Baker
57da2d5713
move uci_load into config_load so that changes can be applied via uci without commiting
...
SVN-Revision: 7927
18 years ago
Felix Fietkau
5e6f8739be
some shell variable handling fixes
...
SVN-Revision: 7638
18 years ago
Felix Fietkau
796e53414f
allow config_* and uci_* functions to work on files outside of /etc/config - these files are assumed to use commands generated by uci_* only (as overlay to regular config files)
...
SVN-Revision: 7636
18 years ago
Florian Fainelli
5b78b9a5e7
Check for modules.d existence before loading modules
...
SVN-Revision: 7423
18 years ago
Felix Fietkau
45c01cae72
add jffs2_mark_erase function for erasing jffs2 partitions on the next mount (typically faster than doing mtd erase manually)
...
SVN-Revision: 6978
18 years ago
Felix Fietkau
30dfff4849
allow scripts to disable config callbacks
...
SVN-Revision: 6934
18 years ago