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

Add base-tiny
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 01 23:09:54 2011 +0100 (2011-02-01)
parents
children 943c1a94316d
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@2 5 CATEGORY="tiny-slitaz"
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@2 36 }
pascal@2 37
pascal@2 38 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@2 39 genpkg_rules()
pascal@2 40 {
pascal@2 41 cp -a fs/. $fs
pascal@2 42 }
pascal@2 43
pascal@2 44 config_form()
pascal@2 45 {
pascal@2 46 [ -n "$PASSWORD" ] || PASSWORD=root
pascal@2 47 [ -n "$INTERFACE" ] || INTERFACE=eth0
pascal@2 48 [ -n "$IP" ] || IP=192.168.0.6
pascal@2 49 [ -n "$NETMASK" ] || NETMASK=255.255.255.0
pascal@2 50 [ -n "$GATEWAY" ] || GATEWAY=192.168.0.1
pascal@2 51 [ -n "$DNS_SERVER" ] || DNS_SERVER='192.168.0.1 192.168.0.2'
pascal@2 52 [ -n "$FSTAB" ] || FSTAB='/dev/hda1 /mnt ext3 defaults 0 2'
pascal@2 53 [ -n "$RC_LOCAL" ] || RC_LOCAL='[ -x /mnt/boot/init ] && /mnt/boot/init'
pascal@2 54 cat <<EOT
pascal@2 55 <table>
pascal@2 56 <tr>
pascal@2 57 <td>Root password</td>
pascal@2 58 <td><input type="text" name="PASSWORD" value="$PASSWORD" /></td>
pascal@2 59 </tr>
pascal@2 60 <tr>
pascal@2 61 <td>Interface</td>
pascal@2 62 <td><input type="text" name="INTERFACE" value="$INTERFACE" /></td>
pascal@2 63 </tr>
pascal@2 64 <tr>
pascal@2 65 <td>Network configuration</td>
pascal@2 66 <td><select name="MODE">
pascal@2 67 <option value="STATIC">STATIC</option>
pascal@2 68 <option value="DHCP"$([ "$MODE" == "DHCP" ] && echo ' selected="selected"')>DHCP</option>
pascal@2 69 </select></td>
pascal@2 70 </tr>
pascal@2 71 <tr>
pascal@2 72 <td>Internet address</td>
pascal@2 73 <td><input type="text" name="IP" value="$IP" /></td>
pascal@2 74 </tr>
pascal@2 75 <tr>
pascal@2 76 <td>Netmask</td>
pascal@2 77 <td><input type="text" name="NETMASK" value="$NETMASK" /></td>
pascal@2 78 </tr>
pascal@2 79 <tr>
pascal@2 80 <td>Gateway</td>
pascal@2 81 <td><input type="text" name="GATEWAY" value="$GATEWAY" /></td>
pascal@2 82 </tr>
pascal@2 83 <tr>
pascal@2 84 <td>DNS server(s)</td>
pascal@2 85 <td><input type="text" name="DNS_SERVER" value="$DNS_SERVER" /></td>
pascal@2 86 </tr>
pascal@2 87 <tr>
pascal@2 88 <td>Filesystems</td>
pascal@2 89 <td><textarea name="FSTAB" cols="60" wrap="off">
pascal@2 90 $FSTAB
pascal@2 91 </textarea></td>
pascal@2 92 </tr>
pascal@2 93 <tr>
pascal@2 94 <td>Additionnal boot commands</td>
pascal@2 95 <td><textarea name="RC_LOCAL" cols="60" wrap="off">
pascal@2 96 $RC_LOCAL
pascal@2 97 </textarea></td>
pascal@2 98 </tr>
pascal@2 99 </table>
pascal@2 100 EOT
pascal@2 101 }
pascal@2 102
pascal@2 103 post_install()
pascal@2 104 {
pascal@2 105 DHCP="no"
pascal@2 106 STATIC="yes"
pascal@2 107 case "$MODE" in
pascal@2 108 "") return 1;;
pascal@2 109 DHCP) DHCP="yes"
pascal@2 110 STATIC="no"
pascal@2 111 esac
pascal@2 112 sed -i -e "s/^DNS_SERVER=.*/DNS_SERVER=\"$DNS_SERVER\"/" \
pascal@2 113 -e "s/^INTERFACE=.*/INTERFACE=\"$INTERFACE\"/" \
pascal@2 114 -e "s/^NETMASK=.*/NETMASK=\"$NETMASK\"/" \
pascal@2 115 -e "s/^GATEWAY=.*/GATEWAY=\"$GATEWAY\"/" \
pascal@2 116 -e "s/^STATIC=.*/STATIC=\"$STATIC\"/" \
pascal@2 117 -e "s/^DHCP=.*/DHCP=\"$DHCP\"/" \
pascal@2 118 -e "s/^IP=.*/IP=\"$IP\"/" $1/etc/network.conf
pascal@2 119 if [ -n "$PASSWORD" ]; then
pascal@2 120 chroot $1/ "echo 'root:$PASSWORD' | chpasswd"
pascal@2 121 else
pascal@2 122 sed -i 's/^root:[^:]*:/root::/' $1/etc/passwd
pascal@2 123 cat > $1/root/.profile <<EOT
pascal@2 124 grep -qs ^root:: /etc/passwd /etc/shadow && passwd
pascal@2 125 EOT
pascal@2 126 fi
pascal@2 127 [ -n "$FSTAB" ] && cat >> $1/etc/fstab <<EOT
pascal@2 128 $FSTAB
pascal@2 129 EOT
pascal@2 130 [ -n "$RC_LOCAL" ] && cat >> $1/etc/init.d/local.sh <<EOT
pascal@2 131 $RC_LOCAL
pascal@2 132 EOT
pascal@2 133 }