tazlito rev 172
tazlitobox: add loram/web
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Mar 26 17:33:07 2010 +0100 (2010-03-26) |
parents | de2c740b24e1 |
children | ca84d0c664e1 |
files | tazlito tazlitobox |
line diff
1.1 --- a/tazlito Fri Mar 26 12:54:31 2010 +0100 1.2 +++ b/tazlito Fri Mar 26 17:33:07 2010 +0100 1.3 @@ -622,9 +622,11 @@ 1.4 [ -s $TMP_DIR/iso/boot/rootfs1.gz ] 1.5 } 1.6 1.7 -# Build initial rootfs for loram ISO ram/cdrom 1.8 +# Build initial rootfs for loram ISO ram/cdrom/http 1.9 build_initfs() 1.10 { 1.11 + urliso="mirror.slitaz.org mirror.switch.ch/ftp/mirror/slitaz \ 1.12 +download.tuxfamily.org/slitaz slitaz.c3sl.ufpr.br" 1.13 version=$(ls $TMP_DIR/iso/boot/vmlinuz-* | sed 's/.*vmlinuz-//') 1.14 need_lib=false 1.15 mkdir -p $TMP_DIR/initfs/bin $TMP_DIR/initfs/dev $TMP_DIR/initfs/lib \ 1.16 @@ -649,7 +651,44 @@ 1.17 cp -a $i $TMP_DIR/initfs/dev 1.18 done 1.19 fi 1.20 - if [ -x /usr/share/boot/busybox-static ]; then 1.21 + if [ "$1" == "http" ]; then 1.22 + mkdir $TMP_DIR/initfs/etc 1.23 + ln -s /proc/mounts $TMP_DIR/initfs/etc/mtab 1.24 + cp /usr/share/udhcpc/default.script $TMP_DIR/initfs/lib/udhcpc 1.25 + sed -i 's|/sbin/||' $TMP_DIR/initfs/lib/udhcpc 1.26 + cp -a /dev/fuse $TMP_DIR/initfs/dev 1.27 + if ! $need_lib && [ -x /usr/share/boot/fusermount-static ]; then 1.28 + cp /usr/share/boot/fusermount-static $TMP_DIR/initfs/bin/httpfs 1.29 + else 1.30 + cp /usr/bin/fusermount $TMP_DIR/initfs/bin 1.31 + need_lib=true 1.32 + fi 1.33 + if ! $need_lib && [ -x /usr/share/boot/httpfs-static ]; then 1.34 + cp /usr/share/boot/httpfs-static $TMP_DIR/initfs/bin/httpfs 1.35 + else 1.36 + [ ! -f /usr/bin/httpfs ] && ! install_package httpfs-fuse && return 1 1.37 + cp /usr/bin/httpfs $TMP_DIR/initfs/bin 1.38 + cp -a /lib/librt* $TMP_DIR/initfs/lib 1.39 + cp -a /lib/libdl* $TMP_DIR/initfs/lib 1.40 + cp -a /lib/libpthread* $TMP_DIR/initfs/lib 1.41 + cp -a /usr/lib/libfuse* $TMP_DIR/initfs/lib 1.42 + cp -a /lib/libresolv* $TMP_DIR/initfs/lib 1.43 + cp -a /lib/libnss_dns* $TMP_DIR/initfs/lib 1.44 + need_lib=true 1.45 + fi 1.46 + cd $TMP_DIR/initfs 1.47 + echo "Get slitaz-release..." 1.48 + for i in $TMP_DIR/iso/boot/rootfs*.gz; do 1.49 + ( zcat $i 2> /dev/null || unlzma -c $i) | \ 1.50 + cpio -idmu etc/slitaz-release > /dev/null 1.51 + done 1.52 + cd - > /dev/null 1.53 + echo "Default urls for /iso/$(cat $TMP_DIR/initfs/etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso: $urliso" 1.54 + echo -n "list of urls to insert: " 1.55 + read -t 30 urliso2 1.56 + urliso="$urliso2 $urliso" 1.57 + fi 1.58 + if ! $need_lib && [ -x /usr/share/boot/busybox-static ]; then 1.59 cp /usr/share/boot/busybox-static $TMP_DIR/initfs/bin/busybox 1.60 else 1.61 cp /bin/busybox $TMP_DIR/initfs/bin 1.62 @@ -696,7 +735,49 @@ 1.63 sed 's/.*rootfssize=\\([0-9]*[kmg%]\\).*/-o size=\\1/')" 1.64 [ -n "\$size" ] || size="-o size=90%" 1.65 1.66 -if [ -f \$(echo /rootfs*.gz | cut -f1 -d' ') ]; then # loram-ram 1.67 +if [ -x /bin/httpfs ]; then # loram-http 1.68 + 1.69 +while read var default; do 1.70 + eval \$var=\$default 1.71 + getarg \$var \$var 1.72 +done <<EOT 1.73 +eth eth0 1.74 +dns 208.67.222.222,208.67.220.220 1.75 +netmask 255.255.255.0 1.76 +gw 1.77 +ip 1.78 +EOT 1.79 +if [ -n "\$ip" ]; then 1.80 + ifconfig \$eth \$ip netmask \$netmask up 1.81 + route add default gateway \$gw 1.82 + for i in \$(echo \$dns | sed 's/,/ /g'); do 1.83 + echo "nameserver \$i" >> /etc/resolv.conf 1.84 + done 1.85 +else 1.86 + udhcpc -s /lib/udhcpc -i \$eth 1.87 +fi 1.88 +for i in $urliso ; do 1.89 + [ -n "\$URLISO" ] && URLISO="\$URLISO," 1.90 + URLISO="\${URLISO}http://\$i/iso/\$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso" 1.91 +done 1.92 +getarg urliso URLISO 1.93 +DIR=fs 1.94 +if getarg loram DIR; then 1.95 + DEVICE=\${DIR%,*} 1.96 + DIR=/\${DIR#*,} 1.97 +fi 1.98 +mount -t tmpfs \$size tmpfs /mnt 1.99 +path=/mnt/.cdrom/ 1.100 +mkdir -p /mnt/.rw \$path 1.101 +while [ ! -d \$path/boot ]; do 1.102 + for i in \$(echo \$URLISO | sed 's/,/ /g'); do 1.103 + httpfs \$i \$path && break 1.104 + done 1.105 + mount -o loop,ro -t iso9660 \$path/*.iso \$path 1.106 +done 1.107 +#copy_rootfs && umount -d \$path && umount -d \$path 1.108 + 1.109 +elif [ -f \$(echo /rootfs*.gz | cut -f1 -d' ') ]; then # loram-ram 1.110 1.111 total=\$(grep MemTotal /proc/meminfo | sed 's/[^0-9]//g') 1.112 free=\$(grep MemFree /proc/meminfo | sed 's/[^0-9]//g') 1.113 @@ -840,6 +921,18 @@ 1.114 create_iso $OUTPUT $TMP_DIR/loramiso 1.115 } 1.116 1.117 +# Create http bootstrap to load a remove loram_cdrom 1.118 +# Meta flavors are converted to normal flavors. 1.119 +build_loram_http() 1.120 +{ 1.121 + build_initfs http || return 1 1.122 + cp -a $TMP_DIR/iso $TMP_DIR/loramiso 1.123 + rm -f $TMP_DIR/loramiso/boot/rootfs* 1.124 + mv $TMP_DIR/initfs.gz $TMP_DIR/loramiso/boot/rootfs.gz 1.125 + unmeta_boot 1.126 + create_iso $OUTPUT $TMP_DIR/loramiso 1.127 +} 1.128 + 1.129 # Update meta flavor selection sizes. 1.130 # Reduce sizes with rootfs gains. 1.131 update_metaiso_sizes() 1.132 @@ -2074,6 +2167,7 @@ 1.133 1.134 case "$4" in 1.135 cdrom) build_loram_cdrom ;; 1.136 + http) build_loram_http ;; 1.137 *) build_loram_ram ;; 1.138 esac 1.139 umount -d $TMP_DIR/iso
2.1 --- a/tazlitobox Fri Mar 26 12:54:31 2010 +0100 2.2 +++ b/tazlitobox Fri Mar 26 17:33:07 2010 +0100 2.3 @@ -113,8 +113,9 @@ 2.4 2.5 loram_action() 2.6 { 2.7 - case "$LORAM_RAM$LORAM_CDROM" in 2.8 - falsetrue) type=cdrom ;; 2.9 + case "$LORAM_RAM$LORAM_CDROM$LORAM_HTTP" in 2.10 + falsetruefalse) type=cdrom ;; 2.11 + falsefalsetrue) type=http ;; 2.12 *) type=ram ;; 2.13 esac 2.14 xterm -geometry 80x16 \ 2.15 @@ -531,6 +532,10 @@ 2.16 <label>The filesystem may be on CDROM.</label> 2.17 <variable>LORAM_CDROM</variable> 2.18 </radiobutton> 2.19 + <radiobutton> 2.20 + <label>The filesystem is on the WEB.</label> 2.21 + <variable>LORAM_HTTP</variable> 2.22 + </radiobutton> 2.23 </vbox> 2.24 </hbox> 2.25 <hbox>