wok-tiny annotate base-tiny/receipt @ rev 54

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