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