wok-tiny view base-tiny/receipt @ rev 57
busybox: add nc & ether-wake
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Jul 07 17:57:16 2011 +0200 (2011-07-07) |
parents | 323f22b3742f |
children | 044813ac0732 |
line source
1 # SliTaz package receipt.
3 PACKAGE="base-tiny"
4 VERSION="1.0"
5 CATEGORY="configuration"
6 SHORT_DESC="Tiny SliTaz base configuration files"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 WEB_SITE="http://tiny.slitaz.org/"
9 AUTO_SELECTION="always"
10 CONFIG_FILES="/etc/network.conf /etc/passwd /etc/shadow \
11 /root/.profile /etc/fstab /etc/init.d/local.sh"
13 # Rules to configure and make the package.
14 compile_rules()
15 {
16 mkdir -p fs/var/lib fs/etc
17 echo "none" > fs/var/lib/detected-modules
18 echo "LANG=C" > fs/etc/locale.conf
19 while read pkg file ; do
20 if [ ! -s $pkg*/fs$file ]; then
21 tazpkg get $pkg
22 tazpkg extract $pkg*.tazpkg
23 fi
24 mkdir -p fs$(dirname $file)
25 mv $pkg*/fs$file fs$(dirname $file) || return 1
26 done << EOT
27 busybox /etc/udhcpd.conf
28 busybox /etc/inetd.conf
29 slitaz-base-files /etc/fstab
30 slitaz-base-files /etc/group
31 slitaz-boot-scripts /etc/inittab
32 slitaz-boot-scripts /etc/network.conf
33 slitaz-boot-scripts /etc/init.d/local.sh
34 slitaz-boot-scripts /etc/rcS.conf
35 EOT
36 sed -i 's/UDEV=.*/UDEV="no"/;s/hwconf.sh l/l/' fs/etc/rcS.conf
37 }
39 # Rules to gen a SliTaz package suitable for Tazpkg.
40 genpkg_rules()
41 {
42 cp -a fs/. $fs
43 }
45 config_form()
46 {
47 [ -n "$PASSWORD" ] || PASSWORD=root
48 [ -n "$INTERFACE" ] || INTERFACE=eth0
49 [ -n "$IP" ] || IP=192.168.0.6
50 [ -n "$NETMASK" ] || NETMASK=255.255.255.0
51 [ -n "$GATEWAY" ] || GATEWAY=192.168.0.1
52 [ -n "$DNS_SERVER" ] || DNS_SERVER='192.168.0.1 192.168.0.2'
53 [ -n "$FSTAB" ] || FSTAB='/dev/hda1 /mnt ext3 defaults 0 2'
54 [ -n "$RC_LOCAL" ] || RC_LOCAL='[ -x /mnt/boot/init ] && /mnt/boot/init'
55 cat <<EOT
56 <table>
57 <tr>
58 <td>Root password</td>
59 <td><input type="text" name="PASSWORD" value="$PASSWORD" /></td>
60 </tr>
61 <tr>
62 <td>Interface</td>
63 <td><input type="text" name="INTERFACE" value="$INTERFACE" /></td>
64 </tr>
65 <tr>
66 <td>Network configuration</td>
67 <td><select name="MODE">
68 <option value="STATIC">STATIC</option>
69 <option value="DHCP"$([ "$MODE" == "DHCP" ] && echo ' selected="selected"')>DHCP</option>
70 <option value="DISABLE">DISABLE</option>
71 </select></td>
72 </tr>
73 <tr>
74 <td>Internet address</td>
75 <td><input type="text" name="IP" value="$IP" /></td>
76 </tr>
77 <tr>
78 <td>Netmask</td>
79 <td><input type="text" name="NETMASK" value="$NETMASK" /></td>
80 </tr>
81 <tr>
82 <td>Gateway</td>
83 <td><input type="text" name="GATEWAY" value="$GATEWAY" /></td>
84 </tr>
85 <tr>
86 <td>DNS server(s)</td>
87 <td><input type="text" name="DNS_SERVER" value="$DNS_SERVER" /></td>
88 </tr>
89 <tr>
90 <td>Filesystems</td>
91 <td><textarea name="FSTAB" cols="60" wrap="off">
92 $FSTAB
93 </textarea></td>
94 </tr>
95 <tr>
96 <td>Additional boot commands</td>
97 <td><textarea name="RC_LOCAL" cols="60" wrap="off">
98 $RC_LOCAL
99 </textarea></td>
100 </tr>
101 </table>
102 EOT
103 }
105 post_install()
106 {
107 DHCP="no"
108 STATIC="yes"
109 case "$MODE" in
110 "") return 1;;
111 DISABLE)
112 STATIC="no" ;;
113 DHCP) DHCP="yes"
114 STATIC="no"
115 esac
116 sed -i -e "s/^DNS_SERVER=.*/DNS_SERVER=\"$DNS_SERVER\"/" \
117 -e "s/^INTERFACE=.*/INTERFACE=\"$INTERFACE\"/" \
118 -e "s/^NETMASK=.*/NETMASK=\"$NETMASK\"/" \
119 -e "s/^GATEWAY=.*/GATEWAY=\"$GATEWAY\"/" \
120 -e "s/^STATIC=.*/STATIC=\"$STATIC\"/" \
121 -e "s/^DHCP=.*/DHCP=\"$DHCP\"/" \
122 -e "s/^IP=.*/IP=\"$IP\"/" $1/etc/network.conf
123 if [ -n "$PASSWORD" ]; then
124 chroot $1/ "echo 'root:$PASSWORD' | chpasswd"
125 else
126 sed -i 's/^root:[^:]*:/root::/' $1/etc/passwd
127 cat > $1/root/.profile <<EOT
128 grep -qs ^root:: /etc/passwd /etc/shadow && passwd
129 EOT
130 fi
131 [ -n "$FSTAB" ] && dos2unix >> $1/etc/fstab <<EOT
132 $FSTAB
133 EOT
134 [ -n "$RC_LOCAL" ] && dos2unix >> $1/etc/init.d/local.sh <<EOT
135 $RC_LOCAL
136 EOT
137 }