diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-08-16 14:14:48 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-08-16 14:17:11 +0000 |
commit | 5b3174f206ce3e65e911086ac09cfd1e86c3e46f (patch) | |
tree | 3b7da23c566d41e54e632c010b721f0f25516ab2 | |
parent | a3c1fbe8ae00e4dc4cd24356113f09eba8771b40 (diff) | |
download | alpine_aports-5b3174f206ce3e65e911086ac09cfd1e86c3e46f.tar.bz2 alpine_aports-5b3174f206ce3e65e911086ac09cfd1e86c3e46f.tar.xz alpine_aports-5b3174f206ce3e65e911086ac09cfd1e86c3e46f.zip |
main/busybox-initscripts: move udhcpc script from alpine-baselayout
Does not belong in the baselayout package
-rw-r--r-- | main/alpine-baselayout/APKBUILD | 4 | ||||
-rw-r--r-- | main/busybox-initscripts/APKBUILD | 16 | ||||
-rw-r--r-- | main/busybox-initscripts/default.script | 108 |
3 files changed, 124 insertions, 4 deletions
diff --git a/main/alpine-baselayout/APKBUILD b/main/alpine-baselayout/APKBUILD index 25a435f3f7..344700454f 100644 --- a/main/alpine-baselayout/APKBUILD +++ b/main/alpine-baselayout/APKBUILD | |||
@@ -1,7 +1,7 @@ | |||
1 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> | 1 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> |
2 | pkgname=alpine-baselayout | 2 | pkgname=alpine-baselayout |
3 | pkgver=2.1.1 | 3 | pkgver=2.1.1 |
4 | pkgrel=0 | 4 | pkgrel=1 |
5 | pkgdesc="Alpine base dir structure and init scripts" | 5 | pkgdesc="Alpine base dir structure and init scripts" |
6 | url=http://git.alpinelinux.org/cgit/alpine-baselayout | 6 | url=http://git.alpinelinux.org/cgit/alpine-baselayout |
7 | depends= | 7 | depends= |
@@ -25,6 +25,6 @@ build() { | |||
25 | package() { | 25 | package() { |
26 | cd "$_builddir" | 26 | cd "$_builddir" |
27 | make install PREFIX= DESTDIR="$pkgdir" || return 1 | 27 | make install PREFIX= DESTDIR="$pkgdir" || return 1 |
28 | rm -f "$pkgdir"/etc/issue | 28 | rm -rf "$pkgdir"/etc/issue "$pkgdir"/usr/share/udhcpc |
29 | } | 29 | } |
30 | md5sums="4f47c32a0e88ae0bd4673a07478525c0 alpine-baselayout-2.1.1.tar.bz2" | 30 | md5sums="4f47c32a0e88ae0bd4673a07478525c0 alpine-baselayout-2.1.1.tar.bz2" |
diff --git a/main/busybox-initscripts/APKBUILD b/main/busybox-initscripts/APKBUILD index 5d1ebdaf37..f676f2c4e7 100644 --- a/main/busybox-initscripts/APKBUILD +++ b/main/busybox-initscripts/APKBUILD | |||
@@ -2,7 +2,7 @@ | |||
2 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> | 2 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> |
3 | pkgname=busybox-initscripts | 3 | pkgname=busybox-initscripts |
4 | pkgver=2.2 | 4 | pkgver=2.2 |
5 | pkgrel=2 | 5 | pkgrel=3 |
6 | pkgdesc="Init scripts for busybox daemons" | 6 | pkgdesc="Init scripts for busybox daemons" |
7 | url="http://git.alpinelinux.org/cgit/aports/tree/core/busybox-initscripts" | 7 | url="http://git.alpinelinux.org/cgit/aports/tree/core/busybox-initscripts" |
8 | arch="noarch" | 8 | arch="noarch" |
@@ -11,13 +11,19 @@ depends="busybox" | |||
11 | makedepends= | 11 | makedepends= |
12 | install=$pkgname.post-install | 12 | install=$pkgname.post-install |
13 | subpackages= | 13 | subpackages= |
14 | replaces="alpine-baselayout" | ||
14 | source="acpid.initd cron.initd dnsd.initd httpd.initd inetd.initd klogd.initd | 15 | source="acpid.initd cron.initd dnsd.initd httpd.initd inetd.initd klogd.initd |
15 | mdev-mount.initd mdev.initd rdate.initd syslog.initd watchdog.initd | 16 | mdev-mount.initd mdev.initd rdate.initd syslog.initd watchdog.initd |
16 | cron.confd klogd.confd rdate.confd syslog.confd watchdog.confd | 17 | cron.confd klogd.confd rdate.confd syslog.confd watchdog.confd |
17 | mdev.conf dvbdev ide_links usbdev usbdisk_link xvd_links | 18 | mdev.conf dvbdev ide_links usbdev usbdisk_link xvd_links |
19 | default.script | ||
18 | " | 20 | " |
19 | 21 | ||
20 | build() { | 22 | build() { |
23 | return 0 | ||
24 | } | ||
25 | |||
26 | package() { | ||
21 | local i | 27 | local i |
22 | cd "$srcdir" | 28 | cd "$srcdir" |
23 | 29 | ||
@@ -38,6 +44,11 @@ build() { | |||
38 | poweroff | 44 | poweroff |
39 | EOF | 45 | EOF |
40 | chmod +x "$pkgdir"/etc/acpi/PWRF/00000080 | 46 | chmod +x "$pkgdir"/etc/acpi/PWRF/00000080 |
47 | |||
48 | # script for udhcpc | ||
49 | install -Dm755 "$srcdir"/default.script \ | ||
50 | "$pkgdir"/usr/share/udhcpc/default.script || return 1 | ||
51 | |||
41 | } | 52 | } |
42 | 53 | ||
43 | md5sums="eba3eab9ace889088e01c6c9e80ae3db acpid.initd | 54 | md5sums="eba3eab9ace889088e01c6c9e80ae3db acpid.initd |
@@ -61,4 +72,5 @@ ad1556961294e4aa2abca6be52138b7c dvbdev | |||
61 | 5c8725b4cbdeda23b00f08124a0d20bf ide_links | 72 | 5c8725b4cbdeda23b00f08124a0d20bf ide_links |
62 | c422992ca5bfdfabdbba1f1532bc1358 usbdev | 73 | c422992ca5bfdfabdbba1f1532bc1358 usbdev |
63 | 30b0c85956b6701caf55309a17e537f6 usbdisk_link | 74 | 30b0c85956b6701caf55309a17e537f6 usbdisk_link |
64 | 826d85313ca7a4a0205d63bd58b7d01f xvd_links" | 75 | 826d85313ca7a4a0205d63bd58b7d01f xvd_links |
76 | c92e18e9d47f4a2a6ca6b3a81ea2f838 default.script" | ||
diff --git a/main/busybox-initscripts/default.script b/main/busybox-initscripts/default.script new file mode 100644 index 0000000000..c6cfbc5be1 --- /dev/null +++ b/main/busybox-initscripts/default.script | |||
@@ -0,0 +1,108 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # script for udhcpc | ||
4 | # Copyright (c) 2008 Natanael Copa <natanael.copa@gmail.com> | ||
5 | |||
6 | UDHCPC="/etc/udhcpc" | ||
7 | UDHCPC_CONF="$UDHCPC/udhcpc.conf" | ||
8 | |||
9 | RESOLV_CONF="/etc/resolv.conf" | ||
10 | [ -f $UDHCPC_CONF ] && . $UDHCPC_CONF | ||
11 | |||
12 | export broadcast | ||
13 | export dns | ||
14 | export domain | ||
15 | export interface | ||
16 | export ip | ||
17 | export mask | ||
18 | export metric | ||
19 | export router | ||
20 | export subnet | ||
21 | |||
22 | export PATH=/usr/bin:/bin:/usr/sbin:/sbin | ||
23 | |||
24 | run_scripts() { | ||
25 | local dir=$1 | ||
26 | if [ -d $dir ]; then | ||
27 | for i in $dir/*; do | ||
28 | [ -f $i ] && $i | ||
29 | done | ||
30 | fi | ||
31 | } | ||
32 | |||
33 | deconfig() { | ||
34 | ip addr flush dev $interface | ||
35 | } | ||
36 | |||
37 | routes() { | ||
38 | [ -z "$router" ] && return | ||
39 | local gw metric | ||
40 | while ip route del default via dev $interface 2>/dev/null; do | ||
41 | : | ||
42 | done | ||
43 | metric=0 | ||
44 | for gw in $router; do | ||
45 | route add default gw $gw dev $interface metric $metric | ||
46 | metric=$(( $metric + 1 )) | ||
47 | done | ||
48 | } | ||
49 | |||
50 | resolvconf() { | ||
51 | local i | ||
52 | if [ "$RESOLV_CONF" = "no" ] || [ "$RESOLV_CONF" = "NO" ] \ | ||
53 | || [ -z "$RESOLV_CONF" ]; then | ||
54 | return | ||
55 | fi | ||
56 | echo -n > "$RESOLV_CONF" | ||
57 | [ -n "$domain" ] && echo "search $domain" >> "$RESOLV_CONF" | ||
58 | for i in $dns; do | ||
59 | echo "nameserver $i" >> "$RESOLV_CONF" | ||
60 | done | ||
61 | } | ||
62 | |||
63 | bound() { | ||
64 | ip addr add $ip/$mask dev $interface | ||
65 | ip link set dev $interface up | ||
66 | routes | ||
67 | resolvconf | ||
68 | } | ||
69 | |||
70 | renew() { | ||
71 | if ! ip addr show dev $interface | grep $ip/$mask; then | ||
72 | ip addr flush dev $interface | ||
73 | ip addr add $ip/$mask dev $interface | ||
74 | fi | ||
75 | |||
76 | local i | ||
77 | for i in $router; do | ||
78 | if ! ip route show | grep ^default | grep $i; then | ||
79 | routes | ||
80 | break | ||
81 | fi | ||
82 | done | ||
83 | |||
84 | if ! grep "^search $domain"; then | ||
85 | resolvconf | ||
86 | return | ||
87 | fi | ||
88 | for i in $dns; do | ||
89 | if ! grep "^nameserver $i"; then | ||
90 | resolvconf | ||
91 | return | ||
92 | fi | ||
93 | done | ||
94 | } | ||
95 | |||
96 | case "$1" in | ||
97 | deconfig|renew|bound) | ||
98 | run_scripts $UDHCPC/pre-$1 | ||
99 | $1 | ||
100 | run_scripts $UDHCPC/post-$1 | ||
101 | ;; | ||
102 | *) | ||
103 | echo "Error: this script should be called from udhcpc" >&2 | ||
104 | exit 1 | ||
105 | ;; | ||
106 | esac | ||
107 | exit 0 | ||
108 | |||