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