summaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions.sh
Commit message (Collapse)AuthorAgeFilesLines
* base-files: make default_prerm work offlineMatthias Schiffer2016-09-261-4/+12
| | | | | | | IPKG_INSTROOT must be respected for offline removal (used for per-device rootfs). Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: rework postinstall uci-defaults handlingJo-Philipp Wich2016-05-271-5/+4
| | | | | | | | | | | | | | | Some package postinstall operations, e.g. those emitted by the LuCI build system, source and delete the uci-defaults themselves upon package insteall, causing the generic defaults apply code to trigger shell errors like: .../luci-app-ddns.postinst: .: line 130: can't open './40_luci-ddns' Rework the generic apply code to check the existence of the uci-defaults script before trying to source it, use sed to prefilter the list of entries from the control file and perform the directory change in a subshell, avoiding the need for cd $OLDPWD. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: evaluate uci-defaults on run-time installationsDaniel Golle2016-05-041-0/+11
| | | | | | | | | | | | Packages may install scripts into /etc/uci-defaults to be executed once after installation, usually at the first boot of the target. This works fine if the package was installed to the rootfs during build or using the ImageBuilder. If the package is installed using opkg during run-time uci-defaults were applied only after a reboot of the device. Avoid the need to reboot by evaluting the package's uci-defaults in default-postinst. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: split user/group addition code into a functionJohn Crispin2016-04-291-4/+10
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* base-files: refactor default_postinst()Jo-Philipp Wich2015-09-161-51/+50
| | | | | | | | | | | | - Simplify user spec parsing code - Alias IPKG_INSTROOT to shorten code - Quote variables where appropriate - Remove a useless-use-of-cat instance - Suppress errors in case control or list files are missing Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 46975
* base-files: default_postinst: propagate the real postinst return codeJohn Crispin2015-08-171-3/+7
| | | | | | | | | | | Using the postinst script for sanity checks and expecting opkg to fail if the postinst didn't return 0 was possible in Barrier Breaker, propagate the real postinst return code through default_postinst to restore this behaviour. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> SVN-Revision: 46653
* base-files: fix default pre-/postrm for packages with a dotJonas Gorski2015-05-191-2/+2
| | | | | | | | | | | | | Instead of stripping everything after the first dot, strip everything after the last dot. This fixes pre-/postrm actions for packages with a dot in their name, like libusb-1.0. Fixes #19668. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 45702
* modules: fix postinst generation for kernel modulesJohn Crispin2015-04-101-4/+7
| | | | | | | | | Fixes ticket #19352. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 45367
* base-files: default_postinst() fix variable colisionJohn Crispin2015-02-041-15/+15
| | | | | | | | | | | | | The name variable contains at first the package name, and after the last group name. This patch fixes /etc/rc.d symlink creation (at least). Change name in pkgname, change the other name in ugname (user group name), and id in ugid (user group id) Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com> SVN-Revision: 44253
* base-files: default_postinst() - create user:group first (resend)John Crispin2014-12-011-2/+4
| | | | | | | | | create user:group before running postinst-pkg. the postinst hook might require the user:group to already exist. Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com> SVN-Revision: 43472
* default_postinst() fix wrong call of group_addJohn Crispin2014-10-151-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | [base-files] default_postinst() fix wrong call of group_add after 12bae65d07d29854204715cebc1ef1eae237fd9b group_add is always called. shell scripting can be tricky... wrong call: [ -n "$gid" ] && group_exists $name || group_add $name $gid this leads to a call of 'group_add' when $gid is emtpy, proof: root@box:~ functionA() { echo A; } root@box:~ functionB() { echo B; } root@box:~ VAR= root@box:~ [ -n "$VAR" ] && functionA || functionB B root@box:~ # functionB was called, but VAR is not filled root@box:~ VAR=filled root@box:~ [ -n "$VAR" ] && functionA || functionB A Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com> SVN-Revision: 42926
* base-files: default_postinst() force clear luci-indexcacheJohn Crispin2014-10-141-0/+1
| | | | | | | | | | Inside every LuCI package you need to clear luci-indexcache and sometimes when installing non LuCI pacakges it's also needed to clear it. Easier put it into default_postinst(). Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com> SVN-Revision: 42923
* base-files: the USERID code path did not check for duplicate groupsJohn Crispin2014-10-141-1/+1
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42919
* base-files: extend USERID:=syntaxJohn Crispin2014-10-081-8/+20
| | | | | | | | | | it is now possible to inlie the uid and gid in the syntax USERID:=username=uid:group=gid:group2=gid2:... Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42838
* base-files: make postinst script run inside a subshellJohn Crispin2014-10-061-1/+1
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42800
* postinst trigger: the new postinst trigger broke IBJohn Crispin2014-09-161-3/+6
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42571
* ipkg: add a default postinst/prerm scriptJohn Crispin2014-09-111-1/+76
| | | | | | | | | | | the postinst script enables/starts the init.d scripts upon package installation and installs the users required by the package. the prerm script stops and disables the init.d scripts. Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42470
* base-files: define yes/no as valid boolean optionsLuka Perkov2014-06-291-2/+2
| | | | | | | | | ubox validate_data defines yes/no as valid boolean options, do the same in config_get_bool too. Signed-off-by: Luka Perkov <luka@openwrt.org> SVN-Revision: 41405
* base-files: add back missing function for find_mtd_part to /lib/functions.sh ↵Felix Fietkau2014-04-081-0/+7
| | | | | | | | (fixes #15496) Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40426
* /lib/functions.sh: remove config_rename()Felix Fietkau2014-04-071-18/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40412
* /lib/functions.sh: move rarely used mtd and macaddr related functions to ↵Felix Fietkau2014-04-071-137/+0
| | | | | | | | /lib/functions/system.sh Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40411
* /lib/functions.sh: remove jffs2_mark_erase()Felix Fietkau2014-04-071-9/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40410
* base-files: remove config_clear() and list_remove()Felix Fietkau2014-04-071-28/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40409
* base-files: move uci_apply_defaults() to /etc/init.d/bootFelix Fietkau2014-04-071-11/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40408
* /lib/functions.sh: remove hotplug_dev()Felix Fietkau2014-04-071-4/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40406
* /lib/functions.sh: remove strtok()Felix Fietkau2014-04-071-26/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40405
* /lib/functions.sh: move preinit related functions to /lib/functions/preinit.shFelix Fietkau2014-04-071-85/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40404
* /lib/functions.sh: remove pi_include()Felix Fietkau2014-04-071-24/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40403
* /lib/functions.sh: remove jffs2_ready()Felix Fietkau2014-04-071-7/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40402
* /lib/functions.sh: remove support for non-overlayfs overlay fopivot typesFelix Fietkau2014-04-071-44/+2
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40401
* base-files: fix mount-utils incompatibilityJohn Crispin2013-12-271-11/+11
| | | | | | Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk> SVN-Revision: 39169
* base-files: allow users to delect debug level during bootJohn Crispin2013-11-251-0/+20
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 38909
* base-files: add macaddr_canonicalize helper functionGabor Juhos2013-11-141-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | 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
* base-files: mtd_get_mac_ascii bugfixGabor Juhos2013-11-081-4/+3
| | | | | | | | | | | | | | | | 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
* base-files: add mtd_get_part_size helperGabor Juhos2013-07-201-0/+12
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 37475
* package: fix insmod on installJohn Crispin2013-06-221-0/+7
| | | | | | | | the procd changes broke the postinst insmod. Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37015
* base-files: module loading is now handled by ubox/kmodloaderJohn Crispin2013-06-211-7/+0
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37003
* base-files: minor cosmetic corrections for functions.shGabor Juhos2013-02-171-6/+3
| | | | | | | | | | | | | - 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
* base-files: add macaddr_{add,2bin,setbit_la} helpersGabor Juhos2013-02-161-0/+24
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35614
* base-files: add mtd_get_mac_{ascii,binary} helpersGabor Juhos2013-02-161-0/+34
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35612
* base-files: Fix a typo in config_list_foreachSteven Barth2012-12-271-1/+1
| | | | SVN-Revision: 34893
* merge /lib/functions/boot.sh and /lib/functions.shMirko Vogt2012-12-191-0/+137
| | | | SVN-Revision: 34794
* Do not overload mount-call - trying to reduce confusionMirko Vogt2012-12-191-3/+0
| | | | | | | | | | | 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
* base-files: add mtd_find_chardev helperGabor Juhos2012-12-121-3/+17
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34648
* Revert "remove function find_mtd_part() from /lib/functions.sh"Mirko Vogt2012-12-121-0/+9
| | | | | | | | | 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
* remove function find_mtd_part() from /lib/functions.shMirko Vogt2012-12-121-9/+0
| | | | | | | | | 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
* base-files: make user_add() populate the shadow db as wellJo-Philipp Wich2012-06-051-0/+1
| | | | SVN-Revision: 32063
* base-files: rename internal variables in config_foreach to make namespace ↵Felix Fietkau2012-04-211-4/+4
| | | | | | conflicts more unlikely SVN-Revision: 31431
* base-files: split service related functions off to /lib/functions/service.shFelix Fietkau2012-03-201-128/+0
| | | | SVN-Revision: 31042
* base-files: remove trailing whitespaces from lib/functions.shGabor Juhos2012-03-021-10/+10
| | | | SVN-Revision: 30775