OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 90... | Line 90... | |||
90 | |
90 | |
|
91 | # config_get <variable> <section> <option> [<default>] |
91 | # config_get <variable> <section> <option> [<default>] |
|
92 | # config_get <section> <option> |
92 | # config_get <section> <option> |
|
93 | config_get() { |
93 | config_get() { |
|
94 | case "$3" in |
94 | case "$3" in |
|
95 | "") eval echo "\"\${CONFIG_${1}_${2}:-\${4}}\"";; |
95 | "") eval echo "\${CONFIG_${1}_${2}:-\${4}}";; |
|
96 | *) eval export ${NO_EXPORT:+-n} -- "${1}=\${CONFIG_${2}_${3}:-\${4}}";; |
96 | *) eval export ${NO_EXPORT:+-n} -- "${1}=\${CONFIG_${2}_${3}:-\${4}}";; |
|
97 | esac |
97 | esac |
|
Line 98... | Line 98... | |||
98 | } |
98 | } |
|
Line 150... | Line 150... | |||
150 | done |
150 | done |
|
151 | } |
151 | } |
|
Line 152... | Line 152... | |||
152 | |
152 | |
|
153 | default_prerm() { |
153 | default_prerm() { |
|
154 | local root="${IPKG_INSTROOT}" |
- | ||
155 | local pkgname="$(basename ${1%.*})" |
154 | local root="${IPKG_INSTROOT}" |
|
Line 156... | Line 155... | |||
156 | local ret=0 |
155 | local name |
|
157 | |
156 | |
|
158 | if [ -f "$root/usr/lib/opkg/info/${pkgname}.prerm-pkg" ]; then |
- | ||
159 | ( . "$root/usr/lib/opkg/info/${pkgname}.prerm-pkg" ) |
- | ||
Line 160... | Line 157... | |||
160 | ret=$? |
157 | name=$(basename ${1%.*}) |
|
161 | fi |
158 | [ -f "$root/usr/lib/opkg/info/${name}.prerm-pkg" ] && . "$root/usr/lib/opkg/info/${name}.prerm-pkg" |
|
162 | |
159 | |
|
163 | local shell="$(which bash)" |
160 | local shell="$(which bash)" |
|
164 | for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do |
161 | for i in `cat "$root/usr/lib/opkg/info/${name}.list" | grep "^/etc/init.d/"`; do |
|
165 | if [ -n "$root" ]; then |
162 | if [ -n "$root" ]; then |
|
166 | ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable |
163 | ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable |
|
167 | else |
164 | else |
|
168 | if [ "$PKG_UPGRADE" != "1" ]; then |
165 | if [ "$PKG_UPGRADE" != "1" ]; then |
|
169 | "$i" disable |
166 | "$i" disable |
|
170 | fi |
167 | fi |
|
171 | "$i" stop |
- | ||
172 | fi |
- | ||
173 | done |
168 | "$i" stop || /bin/true |
|
Line 174... | Line 169... | |||
174 | |
169 | fi |
|
175 | return $ret |
170 | done |
|
176 | } |
171 | } |
|
Line 232... | Line 227... | |||
232 | fi |
227 | fi |
|
Line 233... | Line 228... | |||
233 | |
228 | |
|
234 | if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then |
229 | if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then |
|
235 | . /lib/functions/system.sh |
230 | . /lib/functions/system.sh |
|
236 | [ -d /tmp/.uci ] || mkdir -p /tmp/.uci |
231 | [ -d /tmp/.uci ] || mkdir -p /tmp/.uci |
|
- | 232 | for i in $(sed -ne 's!^/etc/uci-defaults/!!p' "/usr/lib/opkg/info/${pkgname}.list"); do ( |
||
237 | for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do |
233 | cd /etc/uci-defaults |
|
238 | ( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i" |
234 | [ -f "$i" ] && . ./"$i" && rm -f "$i" |
|
239 | done |
235 | ) done |
|
240 | uci commit |
236 | uci commit |
|
Line 241... | Line 237... | |||
241 | fi |
237 | fi |