slitaz-modular annotate mkiso.sh @ rev 143
mkiso.sh: Use $INSTALLED and fixed blocking packages in backupall.banned list.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Fri Oct 14 05:52:47 2011 +0000 (2011-10-14) |
parents | fcf25c41152d |
children | 74ae03ca4c23 |
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@139 | 53 HG_LIST="cookutils flavors flavors-stable slitaz-base-files slitaz-configs slitaz-dev-tools slitaz-doc slitaz-forge slitaz-modular slitaz-pizza slitaz-tools ssfs tazlito tazpanel tazpkg tazusb tazweb tazwok website wok wok-stable wok-tiny wok-undigest" |
slaxemulator@139 | 54 MY_HG_LIST="slitaz-doc-wiki-data 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@143 | 148 if [ ! -f ${INITRAMFS}${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@143 | 218 if [ -d ${MODULES_DIR}/${mod}${INSTALLED} ]; then |
slaxemulator@0 | 219 echo "${mod} module exist. Moving on." |
slaxemulator@143 | 220 elif [ ! -d ${MODULES_DIR}/${mod}${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@143 | 224 if [ ! -f ${UNION}${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@143 | 236 if [ -f ${UNION}${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@143 | 337 [ -f $PROFILE/list/backupall.banned ] && cp -a $PROFILE/list/backupall.banned $ISODIR/blocked |
slaxemulator@143 | 338 |
slaxemulator@122 | 339 cat $cookorder | grep -v "^#" | while read pkg; do |
slaxemulator@122 | 340 [ -f "$WOK/$pkg/receipt" ] || continue |
slaxemulator@122 | 341 unset rwanted pkg_VERSION incoming_pkg_VERSION cache_pkg_VERSION |
slaxemulator@125 | 342 rwanted=$(grep $'\t'$pkg$ $PKGS/wanted.txt | cut -f 1) |
slaxemulator@29 | 343 pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $PACKAGES_REPOSITORY/packages.txt | \ |
slaxemulator@29 | 344 tail -1 | sed 's/ *//')" |
slaxemulator@41 | 345 incoming_pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $INCOMING_REPOSITORY/packages.txt | \ |
slaxemulator@41 | 346 tail -1 | sed 's/ *//')" |
slaxemulator@117 | 347 cache_pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $LOCALSTATE/packages.txt | \ |
slaxemulator@117 | 348 tail -1 | sed 's/ *//')" |
slaxemulator@29 | 349 for wanted in $rwanted; do |
slaxemulator@122 | 350 if [ -f $PROFILE/list/backupall.banned ]; then |
slaxemulator@143 | 351 if [ "$BACKUP_ALL" = "yes" ]; then |
slaxemulator@137 | 352 [ $(grep -l "^$wanted$" $PROFILE/list/backupall.banned) ] && continue |
slaxemulator@143 | 353 fi |
slaxemulator@122 | 354 fi |
slaxemulator@41 | 355 if [ -f $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 356 info "Backing up $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@41 | 357 ln -sf $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$incoming_pkg_VERSION.tazpkg |
slaxemulator@41 | 358 elif [ -f $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 359 info "Backing up $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@34 | 360 ln -sf $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$pkg_VERSION.tazpkg |
slaxemulator@117 | 361 elif [ -f $CACHE_REPOSITORY/$Wanted-$cache_pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 362 info "Backing up $CACHE_REPOSITORY/$wanted-$cache_pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@117 | 363 ln -sf $CACHE_REPOSITORY/$wanted-$cache_pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$cache_pkg_VERSION.tazpkg |
slaxemulator@29 | 364 fi |
slaxemulator@29 | 365 done |
slaxemulator@137 | 366 |
slaxemulator@143 | 367 if [ -f $PROFILE/list/backupall.banned ]; then |
slaxemulator@143 | 368 if [ "$BACKUP_ALL" = "yes" ]; then |
slaxemulator@143 | 369 [ $(grep -l "^$pkg$" $PROFILE/list/backupall.banned) ] && continue |
slaxemulator@143 | 370 fi |
slaxemulator@143 | 371 fi |
slaxemulator@143 | 372 |
slaxemulator@117 | 373 if [ -f $INCOMING_REPOSITORY/$pkg-$incoming_pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 374 info "Backing up $INCOMING_REPOSITORY/$pkg-$incoming_pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@117 | 375 ln -sf $INCOMING_REPOSITORY/$pkg-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$pkg-$incoming_pkg_VERSION.tazpkg |
slaxemulator@117 | 376 elif [ -f $PACKAGES_REPOSITORY/$pkg-$pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 377 info "Backing up $PACKAGES_REPOSITORY/$pkg-$pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@117 | 378 ln -sf $PACKAGES_REPOSITORY/$pkg-$pkg_VERSION.tazpkg $PKGISO_DIR/$pkg-$pkg_VERSION.tazpkg |
slaxemulator@117 | 379 elif [ -f $CACHE_REPOSITORY/$pkg-$cache_pkg_VERSION.tazpkg ]; then |
slaxemulator@137 | 380 info "Backing up $CACHE_REPOSITORY/$pkg-$cache_pkg_VERSION.tazpkg" | tee -a $LOG/backup_pkg.log |
slaxemulator@117 | 381 ln -sf $CACHE_REPOSITORY/$pkg-$cache_pkg_VERSION.tazpkg $PKGISO_DIR/$pkg-$cache_pkg_VERSION.tazpkg |
slaxemulator@117 | 382 fi |
slaxemulator@117 | 383 done |
slaxemulator@41 | 384 |
slaxemulator@117 | 385 if [ "$SRC_PKG" = "yes" ]; then |
slaxemulator@122 | 386 cat $cookorder | grep -v "^#" | while read pkg; do |
slaxemulator@122 | 387 [ -f "$WOK/$pkg/receipt" ] || continue |
slaxemulator@117 | 388 [ $(grep ^$pkg$ $PROFILE/list/srcpkg.banned) ] && continue |
slaxemulator@117 | 389 for i in $(grep -l "^SOURCE=\"$pkg\"" $WOK/*/receipt); do |
slaxemulator@117 | 390 unset SOURCE TARBALL WANTED PACKAGE VERSION COOK_OPT WGET_URL |
slaxemulator@117 | 391 unset pkg_VERSION incoming_pkg_VERSION cache_pkg_VERSION src_pkg src_ver |
slaxemulator@122 | 392 #source $i |
slaxemulator@117 | 393 src_pkg=$(grep ^PACKAGE= $WOK/$pkg/receipt | cut -d "=" -f 2 | sed -e 's/"//g') |
slaxemulator@117 | 394 src_ver=$(grep ^VERSION= $WOK/$pkg/receipt | cut -d "=" -f 2 | sed -e 's/"//g') |
slaxemulator@117 | 395 [ "$VERSION" = "$src_ver" ] || continue |
slaxemulator@122 | 396 pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $PACKAGES_REPOSITORY/packages.txt | \ |
slaxemulator@117 | 397 tail -1 | sed 's/ *//')" |
slaxemulator@122 | 398 incoming_pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $INCOMING_REPOSITORY/packages.txt | \ |
slaxemulator@117 | 399 tail -1 | sed 's/ *//')" |
slaxemulator@122 | 400 cache_pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $LOCALSTATE/packages.txt | \ |
slaxemulator@117 | 401 tail -1 | sed 's/ *//')" |
slaxemulator@125 | 402 rwanted=$(grep $'\t'$src_pkg$ $PKGS/wanted.txt | cut -f 1) |
slaxemulator@117 | 403 |
slaxemulator@117 | 404 for wanted in $rwanted; do |
slaxemulator@117 | 405 if [ -f $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 406 ln -sf $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$incoming_pkg_VERSION.tazpkg |
slaxemulator@117 | 407 elif [ -f $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 408 ln -sf $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$pkg_VERSION.tazpkg |
slaxemulator@117 | 409 elif [ -f $CACHE_REPOSITORY/$Wanted-$pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 410 ln -sf $CACHE_REPOSITORY/$wanted-$pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$pkg_VERSION.tazpkg |
slaxemulator@117 | 411 fi |
slaxemulator@117 | 412 done |
slaxemulator@117 | 413 |
slaxemulator@117 | 414 if [ -f $INCOMING_REPOSITORY/$PACKAGE-$incoming_pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 415 ln -sf $INCOMING_REPOSITORY/$PACKAGE-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$PACKAGE-$incoming_pkg_VERSION.tazpkg |
slaxemulator@117 | 416 elif [ -f $PACKAGES_REPOSITORY/$PACKAGE-$pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 417 ln -sf $PACKAGES_REPOSITORY/$PACKAGE-$pkg_VERSION.tazpkg $PKGISO_DIR/$PACKAGE-$pkg_VERSION.tazpkg |
slaxemulator@117 | 418 elif [ -f $CACHE_REPOSITORY/$PACKAGE-$cache_pkg_VERSION.tazpkg ]; then |
slaxemulator@117 | 419 ln -sf $CACHE_REPOSITORY/$PACKAGE-$cache_pkg_VERSION.tazpkg $PKGISO_DIR/$PACKAGE-$cache_pkg_VERSION.tazpkg |
slaxemulator@117 | 420 fi |
slaxemulator@117 | 421 done |
slaxemulator@26 | 422 done |
slaxemulator@117 | 423 fi |
slaxemulator@26 | 424 |
slaxemulator@82 | 425 [ -f $LOG/packages-gen-list.log ] && rm -f $LOG/packages-gen-list.log |
slaxemulator@122 | 426 [ -d $PKGISO_DIR ] && cook pkgdb $PKGISO_DIR | tee -a $LOG/packages-gen-list.log |
slaxemulator@26 | 427 fi |
slaxemulator@26 | 428 |
slaxemulator@26 | 429 } |
slaxemulator@26 | 430 |
slaxemulator@26 | 431 backup_src() { |
slaxemulator@26 | 432 |
slaxemulator@26 | 433 if [ "${BACKUP_PACKAGES}" = "yes" -a "${BACKUP_SOURCES}" = "yes" ]; then |
slaxemulator@80 | 434 [ -d $SOURCES_REPOSITORY ] || mkdir -p $SOURCES_REPOSITORY |
slaxemulator@80 | 435 [ -d $SRCISO_DIR ] && rm -r $SRCISO_DIR |
slaxemulator@80 | 436 mkdir -p $SRCISO_DIR |
slaxemulator@122 | 437 cookorder=$ISODIR/cookorder.list |
slaxemulator@125 | 438 [ "$BACKUP_ALL" = "yes" ] && cookorder=$PKGS/fullco.txt |
slaxemulator@122 | 439 [ -f $LOG/cook-getsrc.log ] && rm -rf $LOG/cook-getsrc.log |
slaxemulator@137 | 440 [ -f $LOG/backup_src.log ] && rm -rf $LOG/backup_src.log |
slaxemulator@122 | 441 cat $cookorder | grep -v "^#"| while read pkg; do |
slaxemulator@122 | 442 if [ -f $PROFILE/list/backupall.banned ]; then |
slaxemulator@143 | 443 if [ "$BACKUP_ALL" = "yes" ]; then |
slaxemulator@122 | 444 [ $(grep -l "^$pkg$" $PROFILE/list/backupall.banned) ] && continue |
slaxemulator@143 | 445 fi |
slaxemulator@122 | 446 fi |
slaxemulator@128 | 447 unset PATCH SOURCE TARBALL WANTED PACKAGE VERSION COOK_OPT WGET_URL KBASEVER |
slaxemulator@125 | 448 unset pkg_VERSION |
slaxemulator@122 | 449 [ -f $WOK/$pkg/receipt ] || continue |
slaxemulator@122 | 450 source $WOK/$pkg/receipt |
slaxemulator@125 | 451 [ "$WGET_URL" ] || continue |
slaxemulator@122 | 452 [ "$TARBALL" ] || continue |
slaxemulator@125 | 453 pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $PKGISO_DIR/packages.txt | \ |
slaxemulator@125 | 454 tail -1 | sed 's/ *//')" |
slaxemulator@125 | 455 [ -f "$PKGISO_DIR/$PACKAGE-$pkg_VERSION.tazpkg" ] || continue |
slaxemulator@122 | 456 #{ [ ! "$TARBALL" ] || [ ! "$WGET_URL" ] ; } && continue |
slaxemulator@137 | 457 LZMA_TARBALL="${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma" |
slaxemulator@128 | 458 if [ "$PATCH" ]; then |
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 else |
slaxemulator@128 | 463 cook $PACKAGE --getsrc | tee -a $LOG/cook-getsrc.log |
slaxemulator@128 | 464 if [ -f "$SOURCES_REPOSITORY/$(basename $PATCH)" ]; then |
slaxemulator@137 | 465 info "Backing up $SOURCES_REPOSITORY/$(basename $PATCH)" | tee -a $LOG/backup_src.log |
slaxemulator@128 | 466 ln -sf $SOURCES_REPOSITORY/$(basename $PATCH) $SRCISO_DIR/$(basename $PATCH) |
slaxemulator@128 | 467 fi |
slaxemulator@128 | 468 fi |
slaxemulator@128 | 469 fi |
slaxemulator@137 | 470 if [ -f "$SOURCES_REPOSITORY/$LZMA_TARBALL" ]; then |
slaxemulator@137 | 471 info "Backing up $SOURCES_REPOSITORY/$LZMA_TARBALL" | tee -a $LOG/backup_src.log |
slaxemulator@137 | 472 ln -sf $SOURCES_REPOSITORY/$LZMA_TARBALL $SRCISO_DIR/$LZMA_TARBALL |
slaxemulator@122 | 473 elif [ -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@122 | 476 else |
slaxemulator@122 | 477 cook $PACKAGE --getsrc | tee -a $LOG/cook-getsrc.log |
slaxemulator@122 | 478 if [ -f "$SOURCES_REPOSITORY/$TARBALL" ]; then |
slaxemulator@137 | 479 info "Backing up $SOURCES_REPOSITORY/$TARBALL" | tee -a $LOG/backup_src.log |
slaxemulator@122 | 480 ln -sf $SOURCES_REPOSITORY/$TARBALL $SRCISO_DIR/$TARBALL |
slaxemulator@137 | 481 elif [ -f "$SOURCES_REPOSITORY/$LZMA_TARBALL" ]; then |
slaxemulator@137 | 482 info "Backing up $SOURCES_REPOSITORY/$LZMA_TARBALL" | tee -a $LOG/backup_src.log |
slaxemulator@137 | 483 ln -sf $SOURCES_REPOSITORY/$LZMA_TARBALL $SRCISO_DIR/$LZMA_TARBALL |
slaxemulator@80 | 484 fi |
slaxemulator@122 | 485 fi |
slaxemulator@80 | 486 done |
slaxemulator@80 | 487 cd $SRCISO_DIR |
slaxemulator@80 | 488 info "Make md5sum file for sources" |
slaxemulator@80 | 489 find * -not -type d | grep -v md5sum | xargs md5sum > md5sum |
slaxemulator@80 | 490 cd $WORKING |
slaxemulator@26 | 491 fi |
slaxemulator@26 | 492 |
slaxemulator@26 | 493 } |
slaxemulator@0 | 494 |
slaxemulator@0 | 495 # _mksquash dirname |
slaxemulator@0 | 496 _mksquash () { |
slaxemulator@0 | 497 if [ ! -d "$1" ]; then |
slaxemulator@0 | 498 error "Error: '$1' is not a directory" |
slaxemulator@0 | 499 return 1 |
slaxemulator@0 | 500 fi |
slaxemulator@0 | 501 |
slaxemulator@0 | 502 if [ ! -d "$2" ]; then |
slaxemulator@0 | 503 error "Error: '$2' is not a directory" |
slaxemulator@0 | 504 return 1 |
slaxemulator@0 | 505 fi |
slaxemulator@0 | 506 |
slaxemulator@0 | 507 if [ ! -d "${1}${3}" ]; then |
slaxemulator@0 | 508 error "Error: '${1}${3}' is not a directory" |
slaxemulator@0 | 509 return 1 |
slaxemulator@0 | 510 fi |
slaxemulator@0 | 511 |
slaxemulator@0 | 512 time_dir="${3}" |
slaxemulator@0 | 513 sqimg="${2}/$(basename ${1}).${EXT}" |
slaxemulator@0 | 514 info "====> Generating SquashFS image for '${1}'" |
slaxemulator@0 | 515 if [ -e "${sqimg}" ]; then |
slaxemulator@0 | 516 dirhaschanged=$(find ${1}${time_dir} -newer ${sqimg}) |
slaxemulator@0 | 517 if [ "${dirhaschanged}" != "" ]; then |
slaxemulator@0 | 518 info "SquashFS image '${sqimg}' is not up to date, rebuilding..." |
slaxemulator@0 | 519 rm "${sqimg}" |
slaxemulator@0 | 520 else |
slaxemulator@0 | 521 info "SquashFS image '${sqimg}' is up to date, skipping." |
slaxemulator@0 | 522 return |
slaxemulator@0 | 523 fi |
slaxemulator@0 | 524 fi |
slaxemulator@0 | 525 |
slaxemulator@0 | 526 info "Creating SquashFS image. This may take some time..." |
slaxemulator@0 | 527 start=$(date +%s) |
slaxemulator@0 | 528 if [ "${QUIET}" = "y" ]; then |
slaxemulator@0 | 529 mksquashfs "${1}" "${sqimg}" -noappend ${MKOPTION} -comp ${COMPRESSION} >/dev/null |
slaxemulator@0 | 530 else |
slaxemulator@0 | 531 mksquashfs "${1}" "${sqimg}" -noappend ${MKOPTION} -comp ${COMPRESSION} |
slaxemulator@0 | 532 fi |
slaxemulator@0 | 533 minutes=$(echo $start $(date +%s) | awk '{ printf "%0.2f",($2-$1)/60 }') |
slaxemulator@0 | 534 info "Image creation done in $minutes minutes." |
slaxemulator@0 | 535 } |
slaxemulator@0 | 536 |
slaxemulator@0 | 537 imgcommon () { |
slaxemulator@41 | 538 for MOD in ${BASE_MODULES}; do |
slaxemulator@41 | 539 if [ -d "${MODULES_DIR}/${MOD}" ]; then |
slaxemulator@143 | 540 _mksquash "${MODULES_DIR}/${MOD}" "$ISODIR/$CDNAME/base" $INSTALLED |
slaxemulator@41 | 541 fi |
slaxemulator@41 | 542 done |
slaxemulator@41 | 543 |
slaxemulator@0 | 544 if [ "${MODULES}" != "" ]; then |
slaxemulator@0 | 545 for MOD in ${MODULES}; do |
slaxemulator@0 | 546 if [ -d "${MODULES_DIR}/${MOD}" ]; then |
slaxemulator@143 | 547 _mksquash "${MODULES_DIR}/${MOD}" "$ISODIR/$CDNAME/modules" $INSTALLED |
slaxemulator@0 | 548 fi |
slaxemulator@0 | 549 done |
slaxemulator@0 | 550 fi |
slaxemulator@80 | 551 |
slaxemulator@0 | 552 if [ "$HG_LIST" != "" ]; then |
slaxemulator@0 | 553 if [ "$COPY_HG" = "yes" ]; then |
slaxemulator@0 | 554 for hg in $HG_LIST; do |
slaxemulator@0 | 555 copy_hg $hg |
slaxemulator@0 | 556 squashfs_hg $hg |
slaxemulator@0 | 557 done |
slaxemulator@0 | 558 fi |
slaxemulator@0 | 559 fi |
slaxemulator@80 | 560 |
slaxemulator@80 | 561 if [ "$MY_HG_LIST" != "" ]; then |
slaxemulator@86 | 562 if [ "$COPY_HG" = "yes" ]; then |
slaxemulator@86 | 563 for my_hg in $MY_HG_LIST; do |
slaxemulator@86 | 564 HG_URL="$MY_HG_URL" |
slaxemulator@86 | 565 copy_hg $my_hg |
slaxemulator@111 | 566 WOK=${HG_DIR}/wok-tank/repos/wok-tank |
slaxemulator@86 | 567 if [ -d $WOK/.hg ]; then |
slaxemulator@86 | 568 cd $WOK |
slaxemulator@87 | 569 if [ "$(hg branch)" != "cooking" ]; then |
slaxemulator@87 | 570 hg update cooking |
slaxemulator@87 | 571 fi |
slaxemulator@86 | 572 cd $PROFILE |
slaxemulator@86 | 573 fi |
slaxemulator@86 | 574 squashfs_hg $my_hg |
slaxemulator@86 | 575 done |
slaxemulator@86 | 576 fi |
slaxemulator@0 | 577 fi |
slaxemulator@80 | 578 |
slaxemulator@34 | 579 [ -d $SRCISO_DIR ] && rm -r $SRCISO_DIR |
slaxemulator@34 | 580 [ -d $PKGISO_DIR ] && rm -r $PKGISO_DIR |
slaxemulator@31 | 581 |
slaxemulator@111 | 582 if [ -d ${HG_DIR}/wok-tank/repos/wok-tank/.hg ]; then |
slaxemulator@111 | 583 WOK=${HG_DIR}/wok-tank/repos/wok-tank |
slaxemulator@80 | 584 backup_pkg |
slaxemulator@80 | 585 backup_src |
slaxemulator@86 | 586 elif [ -d ${HG_DIR}/wok/repos/wok/.hg ]; then |
slaxemulator@86 | 587 WOK=${HG_DIR}/wok/repos/wok |
slaxemulator@26 | 588 backup_pkg |
slaxemulator@26 | 589 backup_src |
slaxemulator@26 | 590 fi |
slaxemulator@0 | 591 |
slaxemulator@0 | 592 info "====> Making bootable image" |
slaxemulator@0 | 593 |
slaxemulator@0 | 594 # Sanity checks |
slaxemulator@0 | 595 if [ ! -d "${ISODIR}" ]; then |
slaxemulator@0 | 596 error "Error: '${ISODIR}' doesn't exist. What did you do?!" |
slaxemulator@0 | 597 exit 1 |
slaxemulator@0 | 598 fi |
slaxemulator@0 | 599 |
slaxemulator@0 | 600 if [ ! -f "${SGNFILE}" ]; then |
slaxemulator@0 | 601 error "Error: the ${SGNFILE} file doesn't exist. This image won't do anything" |
slaxemulator@0 | 602 error " Protecting you from yourself and erroring out here..." |
slaxemulator@0 | 603 exit 1 |
slaxemulator@0 | 604 fi |
slaxemulator@0 | 605 |
slaxemulator@0 | 606 |
slaxemulator@0 | 607 if [ -e "${IMGNAME}" ]; then |
slaxemulator@0 | 608 if [ "${FORCE}" = "y" ]; then |
slaxemulator@0 | 609 info "Removing existing bootable image..." |
slaxemulator@0 | 610 rm -rf "${IMGNAME}" |
slaxemulator@0 | 611 else |
slaxemulator@0 | 612 error "Error: Image '${IMGNAME}' already exists, aborting." |
slaxemulator@0 | 613 exit 1 |
slaxemulator@0 | 614 fi |
slaxemulator@0 | 615 fi |
slaxemulator@0 | 616 |
slaxemulator@0 | 617 } |
slaxemulator@0 | 618 |
slaxemulator@0 | 619 make_iso () { |
slaxemulator@0 | 620 imgcommon |
slaxemulator@15 | 621 |
slaxemulator@15 | 622 info "Creating rootfs.gz" |
slaxemulator@15 | 623 pack_rootfs $INITRAMFS $ISODIR/boot/rootfs.gz |
slaxemulator@0 | 624 |
slaxemulator@19 | 625 if [ -d $PROFILE/rootcd ]; then |
slaxemulator@19 | 626 cp -af $PROFILE/rootcd/* $ISODIR/ |
slaxemulator@19 | 627 fi |
slaxemulator@19 | 628 |
slaxemulator@19 | 629 info "Copying isolinux files..." |
slaxemulator@19 | 630 if [ -d $INITRAMFS/boot/isolinux ]; then |
slaxemulator@19 | 631 cp -a $INITRAMFS/boot/isolinux $ISODIR/boot |
slaxemulator@19 | 632 fi |
slaxemulator@19 | 633 |
slaxemulator@0 | 634 if [ -d ${PROFILE}/overlay ]; then |
slaxemulator@0 | 635 _overlay |
slaxemulator@0 | 636 fi |
slaxemulator@0 | 637 |
slaxemulator@0 | 638 info "Creating ISO image..." |
slaxemulator@41 | 639 genisoimage -R -l -f -o $IMGNAME -b boot/isolinux/isolinux.bin \ |
slaxemulator@17 | 640 -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ |
slaxemulator@41 | 641 -uid 0 -gid 0 \ |
slaxemulator@41 | 642 -udf -allow-limited-size -iso-level 3 \ |
slaxemulator@41 | 643 -V "SliTaz" -input-charset utf-8 -boot-info-table $ISODIR |
slaxemulator@0 | 644 if [ -x /usr/bin/isohybrid ]; then |
slaxemulator@0 | 645 info "Creating hybrid ISO..." |
slaxemulator@0 | 646 isohybrid "${IMGNAME}" |
slaxemulator@0 | 647 fi |
slaxemulator@28 | 648 md5sum "$IMGNAME" > $IMGMD5NAME |
slaxemulator@28 | 649 sed -i "s|$PROFILE/||g" $IMGMD5NAME |
slaxemulator@0 | 650 } |
slaxemulator@0 | 651 |
slaxemulator@86 | 652 if [ "$BASE_MODULES" != "" ]; then |
slaxemulator@2 | 653 union |
slaxemulator@2 | 654 else |
slaxemulator@86 | 655 error "BASE_MODULES was empty. exiting." |
slaxemulator@2 | 656 exit 1 |
slaxemulator@2 | 657 fi |
slaxemulator@0 | 658 |
slaxemulator@0 | 659 make_iso |