wok-4.x rev 11175
apache: do not override certificate
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Nov 02 21:22:00 2011 +0100 (2011-11-02) |
parents | 83a43fa20329 |
children | 25876cc3b5fc |
files | apache/receipt linux/stuff/bootloader.sh |
line diff
1.1 --- a/apache/receipt Wed Nov 02 15:44:21 2011 +0000 1.2 +++ b/apache/receipt Wed Nov 02 21:22:00 2011 +0100 1.3 @@ -69,6 +69,7 @@ 1.4 chown www.www $1/var/log/$PACKAGE 1.5 ping -c 2 $(hostname) > /dev/null 2>&1 || 1.6 sed -i "s/localhost/$(hostname) localhost/" /etc/hosts 1.7 + [ -s $1/etc/ssl/apache/apache.pem ] || 1.8 openssl req -new -x509 -keyout $1/etc/ssl/apache/apache.pem \ 1.9 -out $1/etc/ssl/apache/apache.pem -days 3650 -nodes <<EOT 1.10 $(. /etc/locale.conf ; echo ${LANG#*_})
2.1 --- a/linux/stuff/bootloader.sh Wed Nov 02 15:44:21 2011 +0000 2.2 +++ b/linux/stuff/bootloader.sh Wed Nov 02 21:22:00 2011 +0100 2.3 @@ -15,90 +15,60 @@ 2.4 2.5 Default values: --format 1440 --tracks 80 --prefix floppy. 2.6 2.7 +Or: cat fd0*.img | $0 --extract 2.8 + 2.9 +Create the kernel, cmdline and rootfs files from a floppy set 2.10 + 2.11 Example: 2.12 -$0 /boot/vmlinuz-2.6.30.6 --rdev /dev/ram0 --video -3 --cmdline 'rw lang=fr_FR kmap=fr-latin1 laptop autologin' --initrd /boot/rootfs.gz --initrd ./myconfig.gz 2.13 +$0 /boot/vmlinuz-2.6.30.6 --rdev /dev/ram0 --video -3 \ 2.14 +--cmdline 'rw lang=fr_FR kmap=fr-latin1 laptop autologin' \ 2.15 +--initrd /boot/rootfs.gz --initrd ./myconfig.gz 2.16 EOT 2.17 exit 1 2.18 } 2.19 2.20 -KERNEL="" 2.21 -INITRD="" 2.22 -CMDLINE="" 2.23 -PREFIX="floppy." 2.24 -FORMAT="1440" 2.25 -RDEV="" 2.26 -VIDEO="" 2.27 -FLAGS="" 2.28 -TRACKS="" 2.29 -DEBUG="" 2.30 -while [ -n "$1" ]; do 2.31 - case "$1" in 2.32 - --c*|-c*) CMDLINE="$2"; shift;; 2.33 - --i*|-i*) INITRD="$INITRD $2"; shift;; 2.34 - --p*|-p*) PREFIX="$2"; shift;; 2.35 - --fo*|-f*) FORMAT="$2"; shift;; 2.36 - --fl*) FLAGS="$2"; shift;; # 1 read-only, 0 read-write 2.37 - --r*|-r*) RDEV="$2"; shift;; # /dev/??? 2.38 - --v*|-v*) VIDEO="$2"; shift;; # -3 .. n 2.39 - --t*|-t*) TRACKS="$2"; shift;; # likely 81 .. 84 2.40 - --debug) DEBUG="1";; 2.41 - *) KERNEL="$1";; 2.42 - esac 2.43 - shift 2.44 -done 2.45 -[ -n "$KERNEL" -a -f "$KERNEL" ] || usage 2.46 -if [ -n "$TRACKS" ]; then 2.47 - if [ $(( $FORMAT % $TRACKS )) -ne 0 ]; then 2.48 - echo "Invalid track count for format $FORMAT." 2.49 - usage 2.50 - fi 2.51 -fi 2.52 +ddq() 2.53 +{ 2.54 + dd $@ 2> /dev/null 2.55 +} 2.56 2.57 -# write a 16 bits data 2.58 -# usage: store16 offset data16 file 2.59 -store16() 2.60 +dbg() 2.61 { 2.62 - n=$2; i=2; while [ $i -ne 0 ]; do 2.63 - printf '\\\\x%02X' $(($n & 255)) 2.64 - i=$(($i-1)); n=$(($n >> 8)) 2.65 - done | xargs echo -en | \ 2.66 - dd bs=2 conv=notrunc of=$3 seek=$(( $1 / 2 )) 2> /dev/null 2.67 - [ -n "$DEBUG" ] && printf "store16(%04X) = %04X\n" $1 $2 1>&2 2.68 + [ -n "$DEBUG" ] && echo "$@" 1>&2 2.69 } 2.70 2.71 # write a 32 bits data 2.72 -# usage: storelong offset data32 file 2.73 -storelong() 2.74 +# usage: put offset data32 file [bytes] 2.75 +put() 2.76 { 2.77 - n=$2; i=4; while [ $i -ne 0 ]; do 2.78 + n=$2; for i in $(seq 1 ${4:-4}); do 2.79 printf '\\\\x%02X' $(($n & 255)) 2.80 - i=$(($i-1)); n=$(($n >> 8)) 2.81 - done | xargs echo -en | \ 2.82 - dd bs=4 conv=notrunc of=$3 seek=$(( $1 / 4 )) 2> /dev/null 2.83 - [ -n "$DEBUG" ] && printf "storelong(%04X) = %08X\n" $1 $2 1>&2 2.84 + n=$(($n >> 8)) 2.85 + done | xargs echo -en | ddq bs=1 conv=notrunc of=$3 seek=$1 2.86 + [ -n "$DEBUG" ] && printf "put$4(%04X) = %X\n" $1 $2 1>&2 2.87 } 2.88 2.89 # read a 32 bits data 2.90 -# usage: getlong offset file 2.91 -getlong() 2.92 +# usage: get offset file [bytes] 2.93 +get() 2.94 { 2.95 - dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \ 2.96 - hexdump -e '"" 1/4 "%d" "\n"' 2.97 + ddq if=$2 bs=1 skip=$(($1)) count=${3:-4} | hexdump -e '"" 1/4 "%d"' 2.98 } 2.99 2.100 +SetupSzOfs=0x1F1 2.101 +SyssizeOfs=0x1F4 2.102 +RamfsLenOfs=0x21C 2.103 +ArgPtrOfs=0x228 2.104 + 2.105 floppyset() 2.106 { 2.107 # bzImage offsets 2.108 - CylinderCount=496 2.109 - SetupSzOfs=497 2.110 - FlagsOfs=498 2.111 - SyssizeOfs=500 2.112 - VideoModeOfs=506 2.113 - RootDevOfs=508 2.114 + CylinderCount=0x1F0 2.115 + FlagsOfs=0x1F2 2.116 + VideoModeOfs=0x1FA 2.117 + RootDevOfs=0x1FC 2.118 CodeAdrOfs=0x214 2.119 RamfsAdrOfs=0x218 2.120 - RamfsLenOfs=0x21C 2.121 - ArgPtrOfs=0x228 2.122 2.123 # boot+setup address 2.124 SetupBase=0x90000 2.125 @@ -109,8 +79,8 @@ 2.126 2.127 # Get and patch boot sector 2.128 # See http://hg.slitaz.org/wok/raw-file/711d076b277c/linux/stuff/linux-header-2.6.34.u 2.129 - dd if=$KERNEL bs=512 count=1 of=$bs 2> /dev/null 2.130 - uudecode <<EOT | dd of=$bs conv=notrunc 2> /dev/null 2.131 + ddq if=$KERNEL bs=512 count=1 of=$bs 2.132 + uudecode <<EOT | ddq of=$bs conv=notrunc 2.133 begin-base64 644 - 2.134 /L+6nWgAkAcGF4n8McC5HQDzq1sfD6mg8X1ABlfFd3ixBvOlZWaPR3gGH8ZF 2.135 +D/6l1hB6DQBvgACA3QO6HYBWwseKAJ0LFNH6AoBXuhmAbAgzRCwCM0QTuhl 2.136 @@ -128,35 +98,33 @@ 2.137 EOT 2.138 2.139 # Get setup 2.140 - setupsz=$(getlong $SetupSzOfs $bs) 2.141 - setupszb=$(( $setupsz & 255 )) 2.142 - dd if=$KERNEL bs=512 skip=1 count=$setupszb 2> /dev/null >> $bs 2.143 + setupsz=$(get $SetupSzOfs $bs 1) 2.144 + ddq if=$KERNEL bs=512 skip=1 count=$setupsz >> $bs 2.145 2.146 if [ -n "$TRACKS" ]; then 2.147 - [ -n "$DEBUG" ] && echo -n "--tracks " 1>&2 2.148 - n=$(getlong $CylinderCount $bs) 2.149 - store16 $CylinderCount $(( ($n & -256) + $TRACKS )) $bs 2.150 + dbg -n "--tracks " 2.151 + put $CylinderCount $TRACKS $bs 1 2.152 fi 2.153 if [ -n "$FLAGS" ]; then 2.154 - [ -n "$DEBUG" ] && echo -n "--flags " 1>&2 2.155 - store16 $FlagsOfs $FLAGS $bs 2.156 + dbg -n "--flags " 2.157 + put $FlagsOfs $FLAGS $bs 2 2.158 fi 2.159 if [ -n "$VIDEO" ]; then 2.160 - [ -n "$DEBUG" ] && echo -n "--video " 1>&2 2.161 - store16 $VideoModeOfs $VIDEO $bs 2.162 + dbg -n "--video " 2.163 + put $VideoModeOfs $VIDEO $bs 2 2.164 fi 2.165 if [ -n "$RDEV" ]; then 2.166 - [ -n "$DEBUG" ] && echo -n "--rdev " 1>&2 2.167 + dbg -n "--rdev " 2.168 n=$(stat -c '0x%02t%02T' $RDEV 2> /dev/null) 2.169 [ -n "$n" ] || n=$RDEV 2.170 - store16 $RootDevOfs $n $bs 2.171 + put $RootDevOfs $n $bs 2 2.172 fi 2.173 2.174 # Store cmdline after setup 2.175 if [ -n "$CMDLINE" ]; then 2.176 - [ -n "$DEBUG" ] && echo -n "--cmdline '$CMDLINE' " 1>&2 2.177 - echo -n "$CMDLINE" | dd bs=512 count=1 conv=sync 2> /dev/null >> $bs 2.178 - storelong $ArgPtrOfs $(( $SetupBase + $stacktop )) $bs 2.179 + dbg -n "--cmdline '$CMDLINE' " 2.180 + echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> $bs 2.181 + put $ArgPtrOfs $(( $SetupBase + $stacktop )) $bs 2.182 fi 2.183 2.184 # Compute initramfs size 2.185 @@ -164,39 +132,39 @@ 2.186 padding=0 2.187 for i in $( echo $INITRD | sed 's/,/ /' ); do 2.188 [ -s "$i" ] || continue 2.189 - [ -n "$DEBUG" ] && echo "--initrd $i " 1>&2 2.190 + dbg "--initrd $i " 2.191 initrdlen=$(( $initrdlen + $padding )) 2.192 padding=$(stat -c %s $i) 2.193 initrdlen=$(( $initrdlen + $padding )) 2.194 padding=$(( 4096 - ($padding & 4095) )) 2.195 [ $padding -eq 4096 ] && padding=0 2.196 done 2.197 - Ksize=$(( $(getlong $SyssizeOfs $bs)*16 )) 2.198 + Ksize=$(( $(get $SyssizeOfs $bs)*16 )) 2.199 Kpad=$(( (($Ksize+4095)/4096)*4096 - Ksize )) 2.200 if [ $initrdlen -ne 0 ]; then 2.201 - [ -n "$DEBUG" ] && echo "initrdlen = $initrdlen " 1>&2 2.202 - Kbase=$(getlong $CodeAdrOfs $bs) 2.203 - storelong $RamfsAdrOfs \ 2.204 + dbg "initrdlen = $initrdlen " 2.205 + Kbase=$(get $CodeAdrOfs $bs) 2.206 + put $RamfsAdrOfs \ 2.207 $(( (0x1000000 - $initrdlen) & 0xFFFF0000 )) $bs 2.208 - storelong $RamfsLenOfs $(( ($initrdlen + 3) & -4 )) $bs 2.209 + put $RamfsLenOfs $(( ($initrdlen + 3) & -4 )) $bs 2.210 fi 2.211 2.212 # Output boot sector + setup + cmdline 2.213 - dd if=$bs 2> /dev/null 2.214 + ddq if=$bs 2.215 2.216 # Output kernel code 2.217 - dd if=$KERNEL bs=512 skip=$(( $setupszb + 1 )) 2> /dev/null 2.218 + ddq if=$KERNEL bs=512 skip=$(( $setupsz + 1 )) 2.219 2.220 # Pad to next sector 2.221 Kpad=$(( 512 - ($(stat -c %s $KERNEL) & 511) )) 2.222 - [ $Kpad -eq 512 ] || dd if=/dev/zero bs=1 count=$Kpad 2> /dev/null 2.223 + [ $Kpad -eq 512 ] || ddq if=/dev/zero bs=1 count=$Kpad 2.224 2.225 # Output initramfs 2.226 padding=0 2.227 for i in $( echo $INITRD | sed 's/,/ /' ); do 2.228 [ -s "$i" ] || continue 2.229 - [ $padding -ne 0 ] && dd if=/dev/zero bs=1 count=$padding 2> /dev/null 2.230 - dd if=$i 2> /dev/null 2.231 + [ $padding -ne 0 ] && ddq if=/dev/zero bs=1 count=$padding 2.232 + ddq if=$i 2.233 padding=$(( 4 - ($(stat -c %s $i) & 3) )) 2.234 [ $padding -eq 4 ] && padding=0 2.235 done 2.236 @@ -205,6 +173,47 @@ 2.237 rm -f $bs 2.238 } 2.239 2.240 +KERNEL="" 2.241 +INITRD="" 2.242 +CMDLINE="" 2.243 +PREFIX="floppy." 2.244 +FORMAT="1440" 2.245 +RDEV="" 2.246 +VIDEO="" 2.247 +FLAGS="" 2.248 +TRACKS="" 2.249 +DEBUG="" 2.250 +while [ -n "$1" ]; do 2.251 + case "${1/--/-}" in 2.252 + -c*) CMDLINE="$2"; shift;; 2.253 + -i*) INITRD="$INITRD $2"; shift;; 2.254 + -p*) PREFIX="$2"; shift;; 2.255 + -fl*) FLAGS="$2"; shift;; # 1 read-only, 0 read-write 2.256 + -f*) FORMAT="$2"; shift;; 2.257 + -r*) RDEV="$2"; shift;; # /dev/??? 2.258 + -v*) VIDEO="$2"; shift;; # -3 .. n 2.259 + -t*) TRACKS="$2"; shift;; # likely 81 .. 84 2.260 + -d*) DEBUG="1";; 2.261 + -e*) ddq bs=512 count=2 > kernel 2.262 + setupsz=$(get $SetupSzOfs kernel 1) 2.263 + ddq bs=512 count=$(($setupsz - 1)) >> kernel 2.264 + [ $(get $ArgPtrOfs kernel) -ne 0 ] && 2.265 + ddq bs=512 count=1 | strings > cmdline 2.266 + syssz=$(get $SyssizeOfs kernel) 2.267 + ddq bs=512 count=$(( ($syssz + 31) / 32 )) >> kernel 2.268 + ddq bs=16 seek=$(($syssz + 32 + $setupsz*32)) count=0 of=kernel 2.269 + ramsz=$(get $RamfsLenOfs kernel) 2.270 + ddq bs=512 count=$((($ramsz + 511) / 512)) of=rootfs 2.271 + ddq bs=1 seek=$ramsz count=0 of=rootfs 2.272 + exit ;; 2.273 + *) KERNEL="$1";; 2.274 + esac 2.275 + shift 2.276 +done 2.277 +[ -n "$KERNEL" -a -f "$KERNEL" ] || usage 2.278 +[ -n "$TRACKS" ] && [ $(( $FORMAT % $TRACKS )) -ne 0 ] && 2.279 + echo "Invalid track count for format $FORMAT." && usage 2.280 + 2.281 if [ "$FORMAT" == "0" ]; then # unsplitted 2.282 floppyset > $PREFIX 2.283 exit 2.284 @@ -213,7 +222,7 @@ 2.285 i=1 2.286 ls floppy$$* | while read file ; do 2.287 output=$PREFIX$(printf "%03d" $i) 2.288 - cat $file /dev/zero | dd bs=1k count=$FORMAT conv=sync of=$output 2> /dev/null 2.289 + cat $file /dev/zero | ddq bs=1k count=$FORMAT conv=sync of=$output 2.290 echo $output 2.291 rm -f $file 2.292 i=$(( $i + 1 ))