slitaz-modular annotate mkiso.sh @ rev 137
mkiso.sh: Add output and logs when making links for source dvd so there is some way to debug it.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Sat Sep 10 23:47:21 2011 +0000 (2011-09-10) |
parents | e4662bb8dbb4 |
children | fcf25c41152d |
rev | line source |
---|---|
slaxemulator@26 | 1 #!/bin/bash |
slaxemulator@0 | 2 |
slaxemulator@122 | 3 . /etc/slitaz/slitaz.conf |
slaxemulator@122 | 4 . /etc/slitaz/cook.conf |
slaxemulator@0 | 5 |
slaxemulator@0 | 6 QUIET="y" |
slaxemulator@0 | 7 FORCE="y" |
slaxemulator@0 | 8 export LABEL="slitaz_$(date +%Y%m)" |
slaxemulator@0 | 9 PUBLISHER="Slitaz" |
slaxemulator@0 | 10 APPLICATION="Slitaz" |
slaxemulator@0 | 11 CREATE_DEFAULT="n" |
slaxemulator@17 | 12 BASEDIR="$(pwd)" |
slaxemulator@17 | 13 PROFILE="$BASEDIR/$1" |
slaxemulator@0 | 14 ver="" |
slaxemulator@0 | 15 CDNAME="slitaz" |
slaxemulator@0 | 16 RMSTUFF=n |
slaxemulator@0 | 17 MVSTUFF=n |
slaxemulator@0 | 18 UNGZIP=n |
slaxemulator@15 | 19 EXT="xz" |
slaxemulator@15 | 20 COMPRESSION="xz -Xbcj x86" |
slaxemulator@0 | 21 MKOPTION="-b 256k" |
slaxemulator@34 | 22 BASE_MODULES="" |
slaxemulator@0 | 23 MODULES="" |
slaxemulator@34 | 24 UNION_MODULES="" |
slaxemulator@0 | 25 WORKING="$PROFILE/working" |
slaxemulator@0 | 26 INITRAMFS="$WORKING/initramfs" |
slaxemulator@0 | 27 UNION="$WORKING/union" |
slaxemulator@0 | 28 LOG="$WORKING/log" |
slaxemulator@0 | 29 ISODIR="$WORKING/iso" |
slaxemulator@21 | 30 IMGNAME="$PROFILE/$CDNAME-$1-$(date +%F).iso" |
slaxemulator@0 | 31 IMGMD5NAME="$IMGNAME.md5" |
slaxemulator@15 | 32 LASTBR="$INITRAMFS" |
slaxemulator@0 | 33 SGNFILE="$ISODIR/$CDNAME/livecd.sgn" |
slaxemulator@0 | 34 MODULES_DIR="$WORKING/modules" |
slaxemulator@26 | 35 HG_DIR="$WORKING/hg" |
slaxemulator@26 | 36 HG_URL="http://hg.slitaz.org" |
slaxemulator@86 | 37 HG_PATH="repos" |
slaxemulator@0 | 38 COPY_HG="no" |
slaxemulator@0 | 39 UPDATE_HG="no" |
slaxemulator@0 | 40 BACKUP_SOURCES="no" |
slaxemulator@0 | 41 BACKUP_PACKAGES="no" |
slaxemulator@34 | 42 MIRROR_DIR="mirror" |
slaxemulator@35 | 43 PKGISO_DIR="$ISODIR/$MIRROR_DIR/packages" |
slaxemulator@35 | 44 SRCISO_DIR="$ISODIR/$MIRROR_DIR/src" |
slaxemulator@28 | 45 BACKUP_ALL="no" |
slaxemulator@41 | 46 KEY_FILES="init liblinuxlive linuxrc" |
slaxemulator@0 | 47 CLEAN_MODULES_DIR="no" |
slaxemulator@2 | 48 CLEAN_INITRAMFS="no" |
slaxemulator@122 | 49 LOCAL_REPOSITORY="$SLITAZ" |
slaxemulator@122 | 50 PACKAGES_REPOSITORY="$PKGS" |
slaxemulator@122 | 51 INCOMING_REPOSITORY="$INCOMING" |
slaxemulator@122 | 52 SOURCES_REPOSITORY="$SRC" |
slaxemulator@136 | 53 HG_LIST="cookutils flavors flavors-stable slitaz-base-files slitaz-configs slitaz-dev-tools slitaz-doc slitaz-doc-wiki-data slitaz-forge slitaz-modular slitaz-pizza slitaz-tools ssfs tazlito tazpanel tazpkg tazusb tazweb tazwok website wok wok-stable wok-tiny wok-undigest" |
slaxemulator@125 | 54 MY_HG_LIST="slitaz-boot-scripts my-cookutils wok-tank" |
slaxemulator@80 | 55 MY_HG_URL="https://bitbucket.org/godane" |
slaxemulator@0 | 56 |
slaxemulator@0 | 57 error () { echo -e "\033[1;31;40m!!! \033[1;37;40m$@\033[1;0m"; } |
slaxemulator@0 | 58 warn () { echo -e "\033[1;33;40m*** \033[1;37;40m$@\033[1;0m"; } |
slaxemulator@0 | 59 info () { echo -e "\033[1;32;40m>>> \033[1;37;40m$@\033[1;0m"; } |
slaxemulator@0 | 60 |
slaxemulator@0 | 61 # do UID checking here so someone can at least get usage instructions |
slaxemulator@0 | 62 #if [ "$EUID" != "0" ]; then |
slaxemulator@0 | 63 # error "error: This script must be run as root." |
slaxemulator@0 | 64 # exit 1 |
slaxemulator@0 | 65 #fi |
slaxemulator@19 | 66 if [ ! -d $PROFILE -o "$1" = "" ]; then |
slaxemulator@17 | 67 echo "$0 profile-name" |
slaxemulator@17 | 68 echo "ex $0 core" |
slaxemulator@17 | 69 exit 1 |
slaxemulator@17 | 70 fi |
slaxemulator@0 | 71 |
slaxemulator@19 | 72 ROOT_MOD="$(ls -1 ${PROFILE}/list | head -1)" |
slaxemulator@19 | 73 INST_ROOT="${MODULES_DIR}/$(basename ${ROOT_MOD} .list)" |
slaxemulator@19 | 74 |
slaxemulator@0 | 75 if [ -f ${PROFILE}/config ]; then |
slaxemulator@0 | 76 source ${PROFILE}/config |
slaxemulator@0 | 77 fi |
slaxemulator@0 | 78 |
slaxemulator@0 | 79 _overlay() |
slaxemulator@0 | 80 { |
slaxemulator@0 | 81 if [ -d ${MODULES_DIR}/overlay ]; then |
slaxemulator@0 | 82 rm -rf ${MODULES_DIR}/overlay |
slaxemulator@0 | 83 cp -rf ${PROFILE}/overlay ${MODULES_DIR} |
slaxemulator@41 | 84 cp -af ${BASEDIR}/initramfs/* ${MODULES_DIR}/overlay |
slaxemulator@0 | 85 else |
slaxemulator@0 | 86 cp -rf ${PROFILE}/overlay ${MODULES_DIR} |
slaxemulator@41 | 87 cp -af ${BASEDIR}/initramfs/* ${MODULES_DIR}/overlay |
slaxemulator@41 | 88 fi |
slaxemulator@41 | 89 |
slaxemulator@41 | 90 if [ -f ${MODULES_DIR}/overlay/etc/local-mirror.conf ]; then |
slaxemulator@41 | 91 sed -i "s|^#PKGDIR|PKGDIR=/packages|g" ${MODULES_DIR}/overlay/etc/local-mirror.conf |
slaxemulator@41 | 92 sed -i "s|^#SRCDIR|SRCDIR=/src|g" ${MODULES_DIR}/overlay/etc/local-mirror.conf |
slaxemulator@0 | 93 fi |
slaxemulator@0 | 94 |
slaxemulator@0 | 95 if [ "${QUIET}" = "y" ]; then |
slaxemulator@0 | 96 mksquashfs "${MODULES_DIR}/overlay" "${ISODIR}/${CDNAME}/modules/zzz.overlay.${EXT}" -comp ${COMPRESSION} -noappend ${MKOPTION} >/dev/null |
slaxemulator@0 | 97 else |
slaxemulator@0 | 98 mksquashfs "${MODULES_DIR}/overlay" "${ISODIR}/${CDNAME}/modules/zzz.overlay.${EXT}" -comp ${COMPRESSION} -noappend ${MKOPTION} |
slaxemulator@0 | 99 fi |
slaxemulator@0 | 100 } |
slaxemulator@0 | 101 |
slaxemulator@0 | 102 lzma_switches() |
slaxemulator@0 | 103 { |
slaxemulator@0 | 104 echo "-d$(echo 24) -mt$(grep ^processor < /proc/cpuinfo | wc -l)" |
slaxemulator@0 | 105 } |
slaxemulator@0 | 106 |
slaxemulator@0 | 107 # Pack rootfs |
slaxemulator@0 | 108 pack_rootfs() |
slaxemulator@0 | 109 { |
slaxemulator@0 | 110 ( cd $1 ; find . -print | cpio -o -H newc ) | \ |
slaxemulator@0 | 111 if [ -x /usr/bin/lzma ]; then |
slaxemulator@0 | 112 info "Generating lzma'ed initramfs... " |
slaxemulator@0 | 113 lzma e -si -so $(lzma_switches $1) > $2 |
slaxemulator@0 | 114 else |
slaxemulator@0 | 115 info "Generating gziped initramfs... " |
slaxemulator@0 | 116 gzip -9 > $2 |
slaxemulator@0 | 117 fi |
slaxemulator@0 | 118 echo 1 > /tmp/rootfs |
slaxemulator@0 | 119 } |
slaxemulator@0 | 120 |
slaxemulator@26 | 121 download() |
slaxemulator@26 | 122 { |
slaxemulator@26 | 123 for file in $@; do |
slaxemulator@26 | 124 wget -q $file && break |
slaxemulator@26 | 125 done |
slaxemulator@26 | 126 } |
slaxemulator@26 | 127 |
slaxemulator@0 | 128 initramfs () { |
slaxemulator@0 | 129 |
slaxemulator@17 | 130 if [ ! -e "$BASEDIR/initramfs/initramfs.list" ]; then |
slaxemulator@19 | 131 error "error: $BASEDIR/initramfs/initramfs.list doesn't exist, aborting." |
slaxemulator@0 | 132 exit 1 |
slaxemulator@0 | 133 fi |
slaxemulator@0 | 134 |
slaxemulator@2 | 135 if [ "$CLEAN_INITRAMFS" = "yes" ]; then |
slaxemulator@2 | 136 if [ -d ${INITRAMFS} ]; then |
slaxemulator@2 | 137 rm -Rf ${INITRAMFS} |
slaxemulator@2 | 138 fi |
slaxemulator@2 | 139 fi |
slaxemulator@4 | 140 |
slaxemulator@4 | 141 if [ ! -d ${INITRAMFS} ]; then |
slaxemulator@4 | 142 mkdir -p $INITRAMFS |
slaxemulator@4 | 143 fi |
slaxemulator@4 | 144 |
slaxemulator@0 | 145 info "Making bootable image" |
slaxemulator@82 | 146 [ -f $LOG/initramfs.log ] && rm -f $LOG/initramfs.log |
slaxemulator@17 | 147 cat "$BASEDIR/initramfs/initramfs.list" | grep -v "^#" | while read pkgname; do |
slaxemulator@5 | 148 if [ ! -f ${INITRAMFS}/var/lib/tazpkg/installed/${pkgname}/files.list ]; then |
slaxemulator@126 | 149 tazpkg get-install $pkgname --root=$INITRAMFS 2>&1 | tee -a $LOG/initramfs.log |
slaxemulator@0 | 150 sleep 1 |
slaxemulator@0 | 151 else |
slaxemulator@126 | 152 info "${pkgname} installed" | tee -a $LOG/initramfs.log |
slaxemulator@0 | 153 fi |
slaxemulator@0 | 154 done |
slaxemulator@0 | 155 |
slaxemulator@0 | 156 if [ ! -d $ISODIR/boot ]; then |
slaxemulator@0 | 157 mkdir -p $ISODIR/boot |
slaxemulator@0 | 158 fi |
slaxemulator@0 | 159 |
slaxemulator@15 | 160 #if [ ! -f $ISODIR/boot/bzImage ]; then |
slaxemulator@86 | 161 if [ -f $INITRAMFS/boot/vmlinuz* ]; then |
slaxemulator@34 | 162 cp -a $INITRAMFS/boot/vmlinuz* $ISODIR/boot/bzImage |
slaxemulator@0 | 163 rm -f $INITRAMFS/boot/vmlinuz* |
slaxemulator@86 | 164 fi |
slaxemulator@86 | 165 |
slaxemulator@86 | 166 if [ -f $INITRAMFS/boot/gpxe ]; then |
slaxemulator@86 | 167 cp -a $INITRAMFS/boot/gpxe $ISODIR/boot/gpxe |
slaxemulator@86 | 168 rm -f $INITRAMFS/boot/gpxe |
slaxemulator@86 | 169 fi |
slaxemulator@86 | 170 |
slaxemulator@17 | 171 if [ -d $BASEDIR/initramfs ]; then |
slaxemulator@41 | 172 for i in $KEY_FILES; do |
slaxemulator@41 | 173 if [ -f $BASEDIR/initramfs/$i ]; then |
slaxemulator@41 | 174 cp -af $BASEDIR/initramfs/$i $INITRAMFS |
slaxemulator@41 | 175 fi |
slaxemulator@41 | 176 done |
slaxemulator@0 | 177 fi |
slaxemulator@34 | 178 |
slaxemulator@41 | 179 if [ -f $INITRAMFS/liblinuxlive ]; then |
slaxemulator@41 | 180 sed -i "s|^#MIRROR|MIRROR=$MIRROR_DIR|g" $INITRAMFS/liblinuxlive |
slaxemulator@34 | 181 fi |
slaxemulator@41 | 182 |
slaxemulator@0 | 183 } |
slaxemulator@0 | 184 |
slaxemulator@0 | 185 copy_hg() { |
slaxemulator@26 | 186 if [ ! -d ${HG_DIR}/${1}/${HG_PATH}/${1} ]; then |
slaxemulator@0 | 187 info "Cloning $1 repo ..." |
slaxemulator@26 | 188 hg clone $HG_URL/${1} ${HG_DIR}/${1}/${HG_PATH}/${1} |
slaxemulator@26 | 189 if [ $(grep -l "^HG_URL=$HG_URL" $PROFILE/config) ]; then |
slaxemulator@26 | 190 if [ ! $(grep -l "$HG_URL" ${HG_DIR}/${1}/${HG_PATH}/${1}/.hg/hgrc) ]; then |
slaxemulator@26 | 191 echo "mirror = $HG_URL/$1" >> ${HG_DIR}/${1}/${HG_PATH}/${1}/.hg/hgrc |
slaxemulator@26 | 192 fi |
slaxemulator@26 | 193 fi |
slaxemulator@26 | 194 elif [ -d ${HG_DIR}/${1}/${HG_PATH}/${1} -a ${UPDATE_HG} = "yes" ]; then |
slaxemulator@0 | 195 info "Updating $1 repo ..." |
slaxemulator@26 | 196 cd ${HG_DIR}/${1}/${HG_PATH}/${1} |
slaxemulator@26 | 197 hg pull $HG_URL/${1} -u |
slaxemulator@26 | 198 if [ $(grep -l "^HG_URL=$HG_URL" $PROFILE/config) ]; then |
slaxemulator@26 | 199 if [ ! $(grep -l "$HG_URL" ${HG_DIR}/${1}/${HG_PATH}/${1}/.hg/hgrc) ]; then |
slaxemulator@26 | 200 echo "mirror = $HG_URL/$1" >> ${HG_DIR}/${1}/${HG_PATH}/${1}/.hg/hgrc |
slaxemulator@26 | 201 fi |
slaxemulator@26 | 202 fi |
slaxemulator@0 | 203 cd $PROFILE |
slaxemulator@0 | 204 fi |
slaxemulator@0 | 205 } |
slaxemulator@0 | 206 |
slaxemulator@0 | 207 squashfs_hg() { |
slaxemulator@0 | 208 if [ ! -d "$ISODIR/$CDNAME/modules/hg" ]; then |
slaxemulator@0 | 209 mkdir -p "$ISODIR/$CDNAME/modules/hg" |
slaxemulator@0 | 210 fi |
slaxemulator@26 | 211 if [ -d ${HG_DIR}/${1}/ ]; then |
slaxemulator@26 | 212 _mksquash ${HG_DIR}/${1} "$ISODIR/$CDNAME/modules/hg/" /${HG_PATH}/${1} |
slaxemulator@0 | 213 fi |
slaxemulator@0 | 214 } |
slaxemulator@0 | 215 |
slaxemulator@0 | 216 slitaz_union () { |
slaxemulator@0 | 217 |
slaxemulator@0 | 218 if [ -d ${MODULES_DIR}/${mod}/var/lib/tazpkg/installed ]; then |
slaxemulator@0 | 219 echo "${mod} module exist. Moving on." |
slaxemulator@0 | 220 elif [ ! -d ${MODULES_DIR}/${mod}/var/lib/tazpkg/installed ]; then |
slaxemulator@0 | 221 if [ -f "$PROFILE/list/${mod}.list" ]; then |
slaxemulator@82 | 222 [ -f ${LOG}/${mod}-current.log ] && rm -f ${LOG}/${mod}-current.log |
slaxemulator@0 | 223 cat "$PROFILE/list/${mod}.list" | grep -v "^#" | while read pkgname; do |
slaxemulator@5 | 224 if [ ! -f ${UNION}/var/lib/tazpkg/installed/${pkgname}/files.list ]; then |
slaxemulator@126 | 225 tazpkg get-install $pkgname --root=${UNION} 2>&1 | tee -a ${LOG}/${mod}-current.log |
slaxemulator@0 | 226 sleep 1 |
slaxemulator@0 | 227 else |
slaxemulator@126 | 228 info "${pkgname} installed" | tee -a ${LOG}/${mod}-current.log |
slaxemulator@0 | 229 fi |
slaxemulator@0 | 230 done |
slaxemulator@0 | 231 fi |
slaxemulator@0 | 232 |
slaxemulator@0 | 233 if [ -f $PROFILE/list/${mod}.removelist ]; then |
slaxemulator@82 | 234 [ -f ${LOG}/${mod}-current-removelist.log ] && rm -f ${LOG}/${mod}-current-removelist.log |
slaxemulator@0 | 235 cat "$PROFILE/list/${mod}.removelist" | grep -v "^#" | while read pkgname; do |
slaxemulator@5 | 236 if [ -f ${UNION}/var/lib/tazpkg/installed/${pkgname}/files.list ]; then |
slaxemulator@126 | 237 echo "y" | tazpkg remove ${pkgname} --root=${UNION} 2>&1 | tee -a ${LOG}/${mod}-current-removelist.log |
slaxemulator@0 | 238 sleep 1 |
slaxemulator@0 | 239 else |
slaxemulator@0 | 240 info "${pkgname} removed" |
slaxemulator@0 | 241 fi |
slaxemulator@0 | 242 done |
slaxemulator@0 | 243 fi |
slaxemulator@0 | 244 fi |
slaxemulator@0 | 245 } |
slaxemulator@0 | 246 |
slaxemulator@0 | 247 union () { |
slaxemulator@41 | 248 if [ "$BASE_MODULES" != "" ]; then |
slaxemulator@41 | 249 UNION_MODULES="$BASE_MODULES $MODULES" |
slaxemulator@41 | 250 elif [ "$MODULES" != "" ]; then |
slaxemulator@41 | 251 UNION_MODULES="$MODULES" |
slaxemulator@41 | 252 else |
slaxemulator@41 | 253 error "Error: no modules assigned in config for profile." |
slaxemulator@41 | 254 exit 1 |
slaxemulator@41 | 255 fi |
slaxemulator@41 | 256 |
slaxemulator@0 | 257 mkdir -p $WORKING |
slaxemulator@0 | 258 mkdir -p $UNION |
slaxemulator@0 | 259 mkdir -p $LOG |
slaxemulator@0 | 260 mkdir -p $ISODIR/${CDNAME}/base |
slaxemulator@0 | 261 mkdir -p $ISODIR/${CDNAME}/modules |
slaxemulator@0 | 262 mkdir -p $ISODIR/${CDNAME}/optional |
slaxemulator@0 | 263 mkdir -p $ISODIR/${CDNAME}/rootcopy |
slaxemulator@0 | 264 mkdir -p $ISODIR/${CDNAME}/tmp |
slaxemulator@0 | 265 mkdir -p $LASTBR |
slaxemulator@34 | 266 |
slaxemulator@0 | 267 touch $SGNFILE |
slaxemulator@0 | 268 |
slaxemulator@0 | 269 modprobe aufs |
slaxemulator@0 | 270 if [ $? -ne 0 ]; then |
slaxemulator@0 | 271 error "Error loading Union filesystem module. (aufs)" |
slaxemulator@0 | 272 exit 1 |
slaxemulator@0 | 273 fi |
slaxemulator@15 | 274 |
slaxemulator@15 | 275 # $INITRAMFS is now $LASTBR |
slaxemulator@15 | 276 # This will be copyed to /mnt/memory/changes on boot |
slaxemulator@15 | 277 initramfs |
slaxemulator@0 | 278 |
slaxemulator@0 | 279 mount -t aufs -o br:${LASTBR}=rw aufs ${UNION} |
slaxemulator@0 | 280 if [ $? -ne 0 ]; then |
slaxemulator@0 | 281 error "Error mounting $union." |
slaxemulator@0 | 282 exit 1 |
slaxemulator@0 | 283 fi |
slaxemulator@15 | 284 |
slaxemulator@0 | 285 info "====> Installing packages to '$UNION'" |
slaxemulator@34 | 286 for mod in $UNION_MODULES; do |
slaxemulator@0 | 287 |
slaxemulator@0 | 288 if [ "$CLEAN_MODULES_DIR" = "yes" ]; then |
slaxemulator@0 | 289 if [ -d $MODULES_DIR/$mod ]; then |
slaxemulator@0 | 290 rm -Rf $MODULES_DIR/$mod |
slaxemulator@0 | 291 fi |
slaxemulator@0 | 292 fi |
slaxemulator@0 | 293 |
slaxemulator@0 | 294 if [ ! -d $MODULES_DIR/$mod ]; then |
slaxemulator@0 | 295 mkdir -p $MODULES_DIR/$mod |
slaxemulator@0 | 296 fi |
slaxemulator@0 | 297 info "Adding $MODULES_DIR/$mod as top branch of union." |
slaxemulator@0 | 298 mount -t aufs -o remount,add:0:${MODULES_DIR}/${mod}=rw aufs $UNION |
slaxemulator@0 | 299 info "Adding $LASTBR as lower branch of union." |
slaxemulator@0 | 300 mount -t aufs -o remount,mod:${LASTBR}=rr+wh aufs $UNION |
slaxemulator@0 | 301 LASTBR="$MODULES_DIR/${mod}" |
slaxemulator@0 | 302 |
slaxemulator@0 | 303 slitaz_union |
slaxemulator@0 | 304 done |
slaxemulator@41 | 305 |
slaxemulator@26 | 306 if [ -d ${UNION}/${INSTALLED} ]; then |
slaxemulator@41 | 307 ls ${UNION}/${INSTALLED} | sort > $ISODIR/packages-installed.list |
slaxemulator@26 | 308 fi |
slaxemulator@26 | 309 |
slaxemulator@0 | 310 info "Unmounting union" |
slaxemulator@0 | 311 umount -l "${UNION}" |
slaxemulator@0 | 312 |
slaxemulator@0 | 313 info "Removing unionfs .wh. files." |
slaxemulator@0 | 314 find ${MODULES_DIR} -type f -name ".wh.*" -exec rm {} \; |
slaxemulator@0 | 315 find ${MODULES_DIR} -type d -name ".wh.*" -exec rm -rf {} \; |
slaxemulator@0 | 316 } |
slaxemulator@0 | 317 |
slaxemulator@26 | 318 backup_pkg() { |
slaxemulator@26 | 319 if [ "${BACKUP_PACKAGES}" = "yes" ]; then |
slaxemulator@34 | 320 [ -d $PKGISO_DIR ] && rm -r $PKGISO_DIR |
slaxemulator@137 | 321 [ -f $LOG/backup_pkg.log ] && rm -rf $LOG/backup_pkg.log |
slaxemulator@34 | 322 mkdir -p $PKGISO_DIR |
slaxemulator@26 | 323 info "Making cooking list based installed packages in union" |
slaxemulator@29 | 324 # this is to filter out packages build by get- |
slaxemulator@29 | 325 # packages that don't exist in repo or wok |
slaxemulator@29 | 326 cat $ISODIR/packages-installed.list | while read pkg; do |
slaxemulator@29 | 327 if [ ! -f $WOK/$pkg/receipt ]; then |
slaxemulator@29 | 328 sed -i "s|$pkg||g" $ISODIR/packages-installed.list |
slaxemulator@26 | 329 fi |
slaxemulator@26 | 330 done |
slaxemulator@122 | 331 cook gen-cooklist $ISODIR/packages-installed.list > $ISODIR/cookorder.list |
slaxemulator@125 | 332 [ -f $PKGS/fullco.txt ] || cook gen-wok-db $WOKHG |
slaxemulator@122 | 333 cookorder=$ISODIR/cookorder.list |
slaxemulator@125 | 334 [ "$BACKUP_ALL" = "yes" ] && cookorder=$PKGS/fullco.txt |
slaxemulator@125 | 335 [ "$BACKUP_ALL" = "yes" ] && cp -a $cookorder $PKGISO_DIR/fullco.txt |
slaxemulator@41 | 336 CACHE_REPOSITORY="$CACHE_DIR/$(cat /etc/slitaz-release)/packages" |
slaxemulator@41 | 337 |
slaxemulator@122 | 338 cat $cookorder | grep -v "^#" | while read pkg; do |
slaxemulator@122 | 339 [ -f "$WOK/$pkg/receipt" ] || continue |
slaxemulator@122 | 340 unset rwanted pkg_VERSION incoming_pkg_VERSION cache_pkg_VERSION |
slaxemulator@125 | 341 rwanted=$(grep $'\t'$pkg$ $PKGS/wanted.txt | cut -f 1) |
slaxemulator@122 | 342 if [ -f $PROFILE/list/backupall.banned ]; then |
slaxemulator@122 | 343 [ "$BACKUP_ALL" = "yes" ] && \ |
slaxemulator@122 | 344 [ $(grep -l "^$pkg$" $PROFILE/list/backupall.banned) ] && continue |
slaxemulator@122 | 345 fi |
slaxemulator@29 | 346 pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $PACKAGES_REPOSITORY/packages.txt | \ |
slaxemulator@29 | 347 tail -1 | sed 's/ *//')" |
slaxemulator@41 | 348 incoming_pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $INCOMING_REPOSITORY/packages.txt | \ |
slaxemulator@41 | 349 tail -1 | sed 's/ *//')" |
slaxemulator@117 | 350 cache_pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $LOCALSTATE/packages.txt | \ |
slaxemulator@117 | 351 tail -1 | sed 's/ *//')" |
slaxemulator@29 | 352 for wanted in $rwanted; do |
slaxemulator@122 | 353 if [ -f $PROFILE/list/backupall.banned ]; then |
slaxemulator@122 | 354 [ "$BACKUP_ALL" = "yes" ] && \ |
slaxemulator@137 | 355 [ $(grep -l "^$wanted$" $PROFILE/list/backupall.banned) ] && continue |
slaxemulator@122 | 356 fi |
slaxemulator@41 | 357 if [ -f $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 358 info "Backing up $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@41 | 359 ln -sf $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$incoming_pkg_VERSION.tazpkg |
slaxemulator@41 | 360 elif [ -f $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 361 info "Backing up $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@34 | 362 ln -sf $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$pkg_VERSION.tazpkg |
slaxemulator@117 | 363 elif [ -f $CACHE_REPOSITORY/$Wanted-$cache_pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 364 info "Backing up $CACHE_REPOSITORY/$wanted-$cache_pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@117 | 365 ln -sf $CACHE_REPOSITORY/$wanted-$cache_pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$cache_pkg_VERSION.tazpkg |
slaxemulator@29 | 366 fi |
slaxemulator@29 | 367 done |
slaxemulator@137 | 368 |
slaxemulator@117 | 369 if [ -f $INCOMING_REPOSITORY/$pkg-$incoming_pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 370 info "Backing up $INCOMING_REPOSITORY/$pkg-$incoming_pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@117 | 371 ln -sf $INCOMING_REPOSITORY/$pkg-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$pkg-$incoming_pkg_VERSION.tazpkg |
slaxemulator@117 | 372 elif [ -f $PACKAGES_REPOSITORY/$pkg-$pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 373 info "Backing up $PACKAGES_REPOSITORY/$pkg-$pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@117 | 374 ln -sf $PACKAGES_REPOSITORY/$pkg-$pkg_VERSION.tazpkg $PKGISO_DIR/$pkg-$pkg_VERSION.tazpkg |
slaxemulator@117 | 375 elif [ -f $CACHE_REPOSITORY/$pkg-$cache_pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 376 info "Backing up $CACHE_REPOSITORY/$pkg-$cache_pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@117 | 377 ln -sf $CACHE_REPOSITORY/$pkg-$cache_pkg_VERSION.tazpkg $PKGISO_DIR/$pkg-$cache_pkg_VERSION.tazpkg |
slaxemulator@117 | 378 fi |
slaxemulator@117 | 379 done |
slaxemulator@41 | 380 |
slaxemulator@117 | 381 if [ "$SRC_PKG" = "yes" ]; then |
slaxemulator@122 | 382 cat $cookorder | grep -v "^#" | while read pkg; do |
slaxemulator@122 | 383 [ -f "$WOK/$pkg/receipt" ] || continue |
slaxemulator@117 | 384 [ $(grep ^$pkg$ $PROFILE/list/srcpkg.banned) ] && continue |
slaxemulator@117 | 385 for i in $(grep -l "^SOURCE=\"$pkg\"" $WOK/*/receipt); do |
slaxemulator@117 | 386 unset SOURCE TARBALL WANTED PACKAGE VERSION COOK_OPT WGET_URL |
slaxemulator@117 | 387 unset pkg_VERSION incoming_pkg_VERSION cache_pkg_VERSION src_pkg src_ver |
slaxemulator@122 | 388 #source $i |
slaxemulator@117 | 389 src_pkg=$(grep ^PACKAGE= $WOK/$pkg/receipt | cut -d "=" -f 2 | sed -e 's/"//g') |
slaxemulator@117 | 390 src_ver=$(grep ^VERSION= $WOK/$pkg/receipt | cut -d "=" -f 2 | sed -e 's/"//g') |
slaxemulator@117 | 391 [ "$VERSION" = "$src_ver" ] || continue |
slaxemulator@122 | 392 pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $PACKAGES_REPOSITORY/packages.txt | \ |
slaxemulator@117 | 393 tail -1 | sed 's/ *//')" |
slaxemulator@122 | 394 incoming_pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $INCOMING_REPOSITORY/packages.txt | \ |
slaxemulator@117 | 395 tail -1 | sed 's/ *//')" |
slaxemulator@122 | 396 cache_pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $LOCALSTATE/packages.txt | \ |
slaxemulator@117 | 397 tail -1 | sed 's/ *//')" |
slaxemulator@125 | 398 rwanted=$(grep $'\t'$src_pkg$ $PKGS/wanted.txt | cut -f 1) |
slaxemulator@117 | 399 |
slaxemulator@117 | 400 for wanted in $rwanted; do |
slaxemulator@117 | 401 if [ -f $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 402 ln -sf $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$incoming_pkg_VERSION.tazpkg |
slaxemulator@117 | 403 elif [ -f $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 404 ln -sf $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$pkg_VERSION.tazpkg |
slaxemulator@117 | 405 elif [ -f $CACHE_REPOSITORY/$Wanted-$pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 406 ln -sf $CACHE_REPOSITORY/$wanted-$pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$pkg_VERSION.tazpkg |
slaxemulator@117 | 407 fi |
slaxemulator@117 | 408 done |
slaxemulator@117 | 409 |
slaxemulator@117 | 410 if [ -f $INCOMING_REPOSITORY/$PACKAGE-$incoming_pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 411 ln -sf $INCOMING_REPOSITORY/$PACKAGE-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$PACKAGE-$incoming_pkg_VERSION.tazpkg |
slaxemulator@117 | 412 elif [ -f $PACKAGES_REPOSITORY/$PACKAGE-$pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 413 ln -sf $PACKAGES_REPOSITORY/$PACKAGE-$pkg_VERSION.tazpkg $PKGISO_DIR/$PACKAGE-$pkg_VERSION.tazpkg |
slaxemulator@117 | 414 elif [ -f $CACHE_REPOSITORY/$PACKAGE-$cache_pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 415 ln -sf $CACHE_REPOSITORY/$PACKAGE-$cache_pkg_VERSION.tazpkg $PKGISO_DIR/$PACKAGE-$cache_pkg_VERSION.tazpkg |
slaxemulator@117 | 416 fi |
slaxemulator@117 | 417 done |
slaxemulator@26 | 418 done |
slaxemulator@117 | 419 fi |
slaxemulator@26 | 420 |
slaxemulator@82 | 421 [ -f $LOG/packages-gen-list.log ] && rm -f $LOG/packages-gen-list.log |
slaxemulator@122 | 422 [ -d $PKGISO_DIR ] && cook pkgdb $PKGISO_DIR | tee -a $LOG/packages-gen-list.log |
slaxemulator@26 | 423 fi |
slaxemulator@26 | 424 |
slaxemulator@26 | 425 } |
slaxemulator@26 | 426 |
slaxemulator@26 | 427 backup_src() { |
slaxemulator@26 | 428 |
slaxemulator@26 | 429 if [ "${BACKUP_PACKAGES}" = "yes" -a "${BACKUP_SOURCES}" = "yes" ]; then |
slaxemulator@80 | 430 [ -d $SOURCES_REPOSITORY ] || mkdir -p $SOURCES_REPOSITORY |
slaxemulator@80 | 431 [ -d $SRCISO_DIR ] && rm -r $SRCISO_DIR |
slaxemulator@80 | 432 mkdir -p $SRCISO_DIR |
slaxemulator@122 | 433 cookorder=$ISODIR/cookorder.list |
slaxemulator@125 | 434 [ "$BACKUP_ALL" = "yes" ] && cookorder=$PKGS/fullco.txt |
slaxemulator@122 | 435 [ -f $LOG/cook-getsrc.log ] && rm -rf $LOG/cook-getsrc.log |
slaxemulator@137 | 436 [ -f $LOG/backup_src.log ] && rm -rf $LOG/backup_src.log |
slaxemulator@122 | 437 cat $cookorder | grep -v "^#"| while read pkg; do |
slaxemulator@122 | 438 if [ -f $PROFILE/list/backupall.banned ]; then |
slaxemulator@122 | 439 [ "$BACKUP_ALL" = "yes" ] && \ |
slaxemulator@122 | 440 [ $(grep -l "^$pkg$" $PROFILE/list/backupall.banned) ] && continue |
slaxemulator@122 | 441 fi |
slaxemulator@128 | 442 unset PATCH SOURCE TARBALL WANTED PACKAGE VERSION COOK_OPT WGET_URL KBASEVER |
slaxemulator@125 | 443 unset pkg_VERSION |
slaxemulator@122 | 444 [ -f $WOK/$pkg/receipt ] || continue |
slaxemulator@122 | 445 source $WOK/$pkg/receipt |
slaxemulator@125 | 446 [ "$WGET_URL" ] || continue |
slaxemulator@122 | 447 [ "$TARBALL" ] || continue |
slaxemulator@125 | 448 pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $PKGISO_DIR/packages.txt | \ |
slaxemulator@125 | 449 tail -1 | sed 's/ *//')" |
slaxemulator@125 | 450 [ -f "$PKGISO_DIR/$PACKAGE-$pkg_VERSION.tazpkg" ] || continue |
slaxemulator@122 | 451 #{ [ ! "$TARBALL" ] || [ ! "$WGET_URL" ] ; } && continue |
slaxemulator@137 | 452 LZMA_TARBALL="${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma" |
slaxemulator@128 | 453 if [ "$PATCH" ]; then |
slaxemulator@128 | 454 if [ -f "$SOURCES_REPOSITORY/$(basename $PATCH)" ]; then |
slaxemulator@137 | 455 info "Backing up $SOURCES_REPOSITORY/$(basename $PATCH)" | tee -a $LOG/backup_src.log |
slaxemulator@128 | 456 ln -sf $SOURCES_REPOSITORY/$(basename $PATCH) $SRCISO_DIR/$(basename $PATCH) |
slaxemulator@128 | 457 else |
slaxemulator@128 | 458 cook $PACKAGE --getsrc | tee -a $LOG/cook-getsrc.log |
slaxemulator@128 | 459 if [ -f "$SOURCES_REPOSITORY/$(basename $PATCH)" ]; then |
slaxemulator@137 | 460 info "Backing up $SOURCES_REPOSITORY/$(basename $PATCH)" | tee -a $LOG/backup_src.log |
slaxemulator@128 | 461 ln -sf $SOURCES_REPOSITORY/$(basename $PATCH) $SRCISO_DIR/$(basename $PATCH) |
slaxemulator@128 | 462 fi |
slaxemulator@128 | 463 fi |
slaxemulator@128 | 464 fi |
slaxemulator@137 | 465 if [ -f "$SOURCES_REPOSITORY/$LZMA_TARBALL" ]; then |
slaxemulator@137 | 466 info "Backing up $SOURCES_REPOSITORY/$LZMA_TARBALL" | tee -a $LOG/backup_src.log |
slaxemulator@137 | 467 ln -sf $SOURCES_REPOSITORY/$LZMA_TARBALL $SRCISO_DIR/$LZMA_TARBALL |
slaxemulator@122 | 468 elif [ -f "$SOURCES_REPOSITORY/$TARBALL" ]; then |
slaxemulator@137 | 469 info "Backing up $SOURCES_REPOSITORY/$TARBALL" | tee -a $LOG/backup_src.log |
slaxemulator@122 | 470 ln -sf $SOURCES_REPOSITORY/$TARBALL $SRCISO_DIR/$TARBALL |
slaxemulator@122 | 471 else |
slaxemulator@122 | 472 cook $PACKAGE --getsrc | tee -a $LOG/cook-getsrc.log |
slaxemulator@122 | 473 if [ -f "$SOURCES_REPOSITORY/$TARBALL" ]; then |
slaxemulator@137 | 474 info "Backing up $SOURCES_REPOSITORY/$TARBALL" | tee -a $LOG/backup_src.log |
slaxemulator@122 | 475 ln -sf $SOURCES_REPOSITORY/$TARBALL $SRCISO_DIR/$TARBALL |
slaxemulator@137 | 476 elif [ -f "$SOURCES_REPOSITORY/$LZMA_TARBALL" ]; then |
slaxemulator@137 | 477 info "Backing up $SOURCES_REPOSITORY/$LZMA_TARBALL" | tee -a $LOG/backup_src.log |
slaxemulator@137 | 478 ln -sf $SOURCES_REPOSITORY/$LZMA_TARBALL $SRCISO_DIR/$LZMA_TARBALL |
slaxemulator@80 | 479 fi |
slaxemulator@122 | 480 fi |
slaxemulator@80 | 481 done |
slaxemulator@80 | 482 cd $SRCISO_DIR |
slaxemulator@80 | 483 info "Make md5sum file for sources" |
slaxemulator@80 | 484 find * -not -type d | grep -v md5sum | xargs md5sum > md5sum |
slaxemulator@80 | 485 cd $WORKING |
slaxemulator@26 | 486 fi |
slaxemulator@26 | 487 |
slaxemulator@26 | 488 } |
slaxemulator@0 | 489 |
slaxemulator@0 | 490 # _mksquash dirname |
slaxemulator@0 | 491 _mksquash () { |
slaxemulator@0 | 492 if [ ! -d "$1" ]; then |
slaxemulator@0 | 493 error "Error: '$1' is not a directory" |
slaxemulator@0 | 494 return 1 |
slaxemulator@0 | 495 fi |
slaxemulator@0 | 496 |
slaxemulator@0 | 497 if [ ! -d "$2" ]; then |
slaxemulator@0 | 498 error "Error: '$2' is not a directory" |
slaxemulator@0 | 499 return 1 |
slaxemulator@0 | 500 fi |
slaxemulator@0 | 501 |
slaxemulator@0 | 502 if [ ! -d "${1}${3}" ]; then |
slaxemulator@0 | 503 error "Error: '${1}${3}' is not a directory" |
slaxemulator@0 | 504 return 1 |
slaxemulator@0 | 505 fi |
slaxemulator@0 | 506 |
slaxemulator@0 | 507 time_dir="${3}" |
slaxemulator@0 | 508 sqimg="${2}/$(basename ${1}).${EXT}" |
slaxemulator@0 | 509 info "====> Generating SquashFS image for '${1}'" |
slaxemulator@0 | 510 if [ -e "${sqimg}" ]; then |
slaxemulator@0 | 511 dirhaschanged=$(find ${1}${time_dir} -newer ${sqimg}) |
slaxemulator@0 | 512 if [ "${dirhaschanged}" != "" ]; then |
slaxemulator@0 | 513 info "SquashFS image '${sqimg}' is not up to date, rebuilding..." |
slaxemulator@0 | 514 rm "${sqimg}" |
slaxemulator@0 | 515 else |
slaxemulator@0 | 516 info "SquashFS image '${sqimg}' is up to date, skipping." |
slaxemulator@0 | 517 return |
slaxemulator@0 | 518 fi |
slaxemulator@0 | 519 fi |
slaxemulator@0 | 520 |
slaxemulator@0 | 521 info "Creating SquashFS image. This may take some time..." |
slaxemulator@0 | 522 start=$(date +%s) |
slaxemulator@0 | 523 if [ "${QUIET}" = "y" ]; then |
slaxemulator@0 | 524 mksquashfs "${1}" "${sqimg}" -noappend ${MKOPTION} -comp ${COMPRESSION} >/dev/null |
slaxemulator@0 | 525 else |
slaxemulator@0 | 526 mksquashfs "${1}" "${sqimg}" -noappend ${MKOPTION} -comp ${COMPRESSION} |
slaxemulator@0 | 527 fi |
slaxemulator@0 | 528 minutes=$(echo $start $(date +%s) | awk '{ printf "%0.2f",($2-$1)/60 }') |
slaxemulator@0 | 529 info "Image creation done in $minutes minutes." |
slaxemulator@0 | 530 } |
slaxemulator@0 | 531 |
slaxemulator@0 | 532 imgcommon () { |
slaxemulator@41 | 533 for MOD in ${BASE_MODULES}; do |
slaxemulator@41 | 534 if [ -d "${MODULES_DIR}/${MOD}" ]; then |
slaxemulator@41 | 535 _mksquash "${MODULES_DIR}/${MOD}" "$ISODIR/$CDNAME/base" /var/lib/tazpkg/installed |
slaxemulator@41 | 536 fi |
slaxemulator@41 | 537 done |
slaxemulator@41 | 538 |
slaxemulator@0 | 539 if [ "${MODULES}" != "" ]; then |
slaxemulator@0 | 540 for MOD in ${MODULES}; do |
slaxemulator@0 | 541 if [ -d "${MODULES_DIR}/${MOD}" ]; then |
slaxemulator@41 | 542 _mksquash "${MODULES_DIR}/${MOD}" "$ISODIR/$CDNAME/modules" /var/lib/tazpkg/installed |
slaxemulator@0 | 543 fi |
slaxemulator@0 | 544 done |
slaxemulator@0 | 545 fi |
slaxemulator@80 | 546 |
slaxemulator@0 | 547 if [ "$HG_LIST" != "" ]; then |
slaxemulator@0 | 548 if [ "$COPY_HG" = "yes" ]; then |
slaxemulator@0 | 549 for hg in $HG_LIST; do |
slaxemulator@0 | 550 copy_hg $hg |
slaxemulator@0 | 551 squashfs_hg $hg |
slaxemulator@0 | 552 done |
slaxemulator@0 | 553 fi |
slaxemulator@0 | 554 fi |
slaxemulator@80 | 555 |
slaxemulator@80 | 556 if [ "$MY_HG_LIST" != "" ]; then |
slaxemulator@86 | 557 if [ "$COPY_HG" = "yes" ]; then |
slaxemulator@86 | 558 for my_hg in $MY_HG_LIST; do |
slaxemulator@86 | 559 HG_URL="$MY_HG_URL" |
slaxemulator@86 | 560 copy_hg $my_hg |
slaxemulator@111 | 561 WOK=${HG_DIR}/wok-tank/repos/wok-tank |
slaxemulator@86 | 562 if [ -d $WOK/.hg ]; then |
slaxemulator@86 | 563 cd $WOK |
slaxemulator@87 | 564 if [ "$(hg branch)" != "cooking" ]; then |
slaxemulator@87 | 565 hg update cooking |
slaxemulator@87 | 566 fi |
slaxemulator@86 | 567 cd $PROFILE |
slaxemulator@86 | 568 fi |
slaxemulator@86 | 569 squashfs_hg $my_hg |
slaxemulator@86 | 570 done |
slaxemulator@86 | 571 fi |
slaxemulator@0 | 572 fi |
slaxemulator@80 | 573 |
slaxemulator@34 | 574 [ -d $SRCISO_DIR ] && rm -r $SRCISO_DIR |
slaxemulator@34 | 575 [ -d $PKGISO_DIR ] && rm -r $PKGISO_DIR |
slaxemulator@31 | 576 |
slaxemulator@111 | 577 if [ -d ${HG_DIR}/wok-tank/repos/wok-tank/.hg ]; then |
slaxemulator@111 | 578 WOK=${HG_DIR}/wok-tank/repos/wok-tank |
slaxemulator@80 | 579 backup_pkg |
slaxemulator@80 | 580 backup_src |
slaxemulator@86 | 581 elif [ -d ${HG_DIR}/wok/repos/wok/.hg ]; then |
slaxemulator@86 | 582 WOK=${HG_DIR}/wok/repos/wok |
slaxemulator@26 | 583 backup_pkg |
slaxemulator@26 | 584 backup_src |
slaxemulator@26 | 585 fi |
slaxemulator@0 | 586 |
slaxemulator@0 | 587 info "====> Making bootable image" |
slaxemulator@0 | 588 |
slaxemulator@0 | 589 # Sanity checks |
slaxemulator@0 | 590 if [ ! -d "${ISODIR}" ]; then |
slaxemulator@0 | 591 error "Error: '${ISODIR}' doesn't exist. What did you do?!" |
slaxemulator@0 | 592 exit 1 |
slaxemulator@0 | 593 fi |
slaxemulator@0 | 594 |
slaxemulator@0 | 595 if [ ! -f "${SGNFILE}" ]; then |
slaxemulator@0 | 596 error "Error: the ${SGNFILE} file doesn't exist. This image won't do anything" |
slaxemulator@0 | 597 error " Protecting you from yourself and erroring out here..." |
slaxemulator@0 | 598 exit 1 |
slaxemulator@0 | 599 fi |
slaxemulator@0 | 600 |
slaxemulator@0 | 601 |
slaxemulator@0 | 602 if [ -e "${IMGNAME}" ]; then |
slaxemulator@0 | 603 if [ "${FORCE}" = "y" ]; then |
slaxemulator@0 | 604 info "Removing existing bootable image..." |
slaxemulator@0 | 605 rm -rf "${IMGNAME}" |
slaxemulator@0 | 606 else |
slaxemulator@0 | 607 error "Error: Image '${IMGNAME}' already exists, aborting." |
slaxemulator@0 | 608 exit 1 |
slaxemulator@0 | 609 fi |
slaxemulator@0 | 610 fi |
slaxemulator@0 | 611 |
slaxemulator@0 | 612 } |
slaxemulator@0 | 613 |
slaxemulator@0 | 614 make_iso () { |
slaxemulator@0 | 615 imgcommon |
slaxemulator@15 | 616 |
slaxemulator@15 | 617 info "Creating rootfs.gz" |
slaxemulator@15 | 618 pack_rootfs $INITRAMFS $ISODIR/boot/rootfs.gz |
slaxemulator@0 | 619 |
slaxemulator@19 | 620 if [ -d $PROFILE/rootcd ]; then |
slaxemulator@19 | 621 cp -af $PROFILE/rootcd/* $ISODIR/ |
slaxemulator@19 | 622 fi |
slaxemulator@19 | 623 |
slaxemulator@19 | 624 info "Copying isolinux files..." |
slaxemulator@19 | 625 if [ -d $INITRAMFS/boot/isolinux ]; then |
slaxemulator@19 | 626 cp -a $INITRAMFS/boot/isolinux $ISODIR/boot |
slaxemulator@19 | 627 fi |
slaxemulator@19 | 628 |
slaxemulator@0 | 629 if [ -d ${PROFILE}/overlay ]; then |
slaxemulator@0 | 630 _overlay |
slaxemulator@0 | 631 fi |
slaxemulator@0 | 632 |
slaxemulator@0 | 633 info "Creating ISO image..." |
slaxemulator@41 | 634 genisoimage -R -l -f -o $IMGNAME -b boot/isolinux/isolinux.bin \ |
slaxemulator@17 | 635 -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ |
slaxemulator@41 | 636 -uid 0 -gid 0 \ |
slaxemulator@41 | 637 -udf -allow-limited-size -iso-level 3 \ |
slaxemulator@41 | 638 -V "SliTaz" -input-charset utf-8 -boot-info-table $ISODIR |
slaxemulator@0 | 639 if [ -x /usr/bin/isohybrid ]; then |
slaxemulator@0 | 640 info "Creating hybrid ISO..." |
slaxemulator@0 | 641 isohybrid "${IMGNAME}" |
slaxemulator@0 | 642 fi |
slaxemulator@28 | 643 md5sum "$IMGNAME" > $IMGMD5NAME |
slaxemulator@28 | 644 sed -i "s|$PROFILE/||g" $IMGMD5NAME |
slaxemulator@0 | 645 } |
slaxemulator@0 | 646 |
slaxemulator@86 | 647 if [ "$BASE_MODULES" != "" ]; then |
slaxemulator@2 | 648 union |
slaxemulator@2 | 649 else |
slaxemulator@86 | 650 error "BASE_MODULES was empty. exiting." |
slaxemulator@2 | 651 exit 1 |
slaxemulator@2 | 652 fi |
slaxemulator@0 | 653 |
slaxemulator@0 | 654 make_iso |