Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #simple script to remaster the puppy live-cd.
- #(c) Copyright 2006 Barry Kauler, www.puppyos.com
- #2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
- #v411 update what gets copied from /root and /etc.
- #v412 /etc/DISTRO_SPECS, renamed pup_xxx.sfs, pup_save.2fs etc.
- # 22jun09 by Masaki Shinomiya <shino@pos.to> bugfix in cd drive selection
- # 01jul09 needed space calculation
- # 08jul09 loop mounted iso file usable
- # 7aug09 grub4dos support
- #w482 shinobar: exclude /lib/modules/${KERNELVER}/initrd.
- #v431JP mkisofs with Joliet option, volume id, what copied from cd, remove slmodems
- #091212 weird bug, no processes but when run this, x restarts...
- # 28dec09 remove /modules/${KERNELVER}/modules.*
- #110505 support sudo for non-root user.
- #110808 PANZERKOPF: bug fix. 110822 reverted.
- #120605 rerwin: omit /dev/snd content, /dev/.udev subdirectory and modem daemons from new master (because daemons reinstalled from firmware if needed).
- #120606 rerwin: support users' replacement of stripped /root & /etc with complete directories (for "boot disk").
- #120607 rerwin: Remove indicators/files for integrated user-installed packages.
- #120721 revert 'wildcards' option (from 120605); improve /dev/snd file exclusion; exclude /usr/share/icons/hicolor/icon-theme.cache (shinobar).
- #121021 rerwin: revert 120605 modem daemon removals (because daemons no longer copied from firmware directory).
- #130222 convert internationalization from "technosaurus method" to gettext method.
- #130222 virtual-CD detection was broken.
- #130223 various fixes. note, also fixed /usr/sbin/filemnt. now can retain files between remasters.
- #130301 o/p of "losetup" (BB), shows all in use, but "losetup-FULL -a" needs param, also o/p format different.
- #130302 L18L: moved m_09 m_10 m_11 top and made another use of it.
- #130306 gettext translation fixed, line 354. 130307 again.
- #130308 npierce: filter out wrong CDs from choices offered to user; remove CD drive from VIRTUALCD list.
- #130527 /etc/.XLOADED has been moved to /root, refer /usr/bin/xwin.
- [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
- TMP=/tmp/remasterpup2
- #NOTE: rename to avoid clash with 'remasterpup2.mo' used by previous i18n method.
- export TEXTDOMAIN=remasterpup2x
- export OUTPUT_CHARSET=UTF-8
- . gettext.sh
- set_home_action(){
- etc_action=${etc_action:-"$1"}
- root_action=${root_action:-"$1"}
- spot_action=${spot_action:-"$1"}
- fido_action=${fido_action:-"$1"}
- puppy_action=${puppy_action:-"$1"}
- }
- TEMP=`getopts -o ae:r:p:f: --long auto,:etc,root:,home:,spot:,fido -- "$@"`
- eval set -- "$TEMP"
- while true; do
- case "$1" in
- -a|--auto)
- set_home_action "default"
- customize_etc=${customize_etc:-no} #Don't customize ect based on hardware
- MK_NEW_ISO_ROOT=${MK_NEW_ISO_ROOT:-yes}
- -e|--etc) etc_action=$2; shift 2; ;;
- -r|--root) root_action=$2; shift 2; ;;
- -s|--spot) spot_action=$2; shift 2; ;;
- -f|--fido) fido_action=$2; shift 2; ;;
- -p|--puppy) puppy_action=$2; shift 2; ;;
- -h|--home)
- set_home_action "$2"
- shift 2
- ;;
- -i|--iso-root-old) ISO_ROOT_old="$2"; shift 2; ;;
- -n|--make-new-isoroot) MK_NEW_ISO_ROOT="$2"; shift 2; ;;
- -o|--iso-root-new) ISO_ROOT_new="$2"; shift 2; ;;
- -w|--working-partition)
- WKGPART="$2"; shift 2; ;;
- -m|--working-mount-point)
- WKGMNTPT="$2"; shift 2; ;;
- -c|--customize customize_etc=$2
- ;;
- esac
- done
- Yes_lbl="$(gettext 'Yes')"
- No_lbl="$(gettext 'No')"
- m_01="$(gettext 'Puppy simple CD remaster')" #window title.
- m_02="$(gettext 'ERROR')"
- m_07="$(gettext 'currently mounted')"
- m_08="$(gettext 'not mounted')"
- m_09="$(gettext 'Filesystem')" #130302
- m_10="$(gettext 'Size')" #130302
- m_11="$(gettext 'Free')" #130302
- choice_cdd () {
- #copy files off live-cd.... w018 use probedisk2...
- SELECTIONS="`probedisk 2>&1 | grep '^/dev/' | grep "|optical|" | cut -f 1,3 -d "|" | tr " " "_" | tr "|" " " | tr '$' "_"`"
- SELECTIONS="$SELECTIONS $VIRTUALCD"
- if [ "$(echo "$SELECTIONS"|tr -d ' ')" = "" ]; then
- m_14_2="$(gettext 'NO CD/DVD drives found.')"
- Xdialog --wrap --left --title "$m_01: $m_02" --msgbox "$m_14_2
- $MSG" 0 80
- exit 1
- fi
- if [ "$1" = "filter" ];then #130308 Filter out devices with a missing file.
- FILT_SELECTIONS=""
- i="0"
- for ASELECTION in $SELECTIONS
- do
- if [ "$((i++&1))" -eq "0" ];then
- BLKDEV="$ASELECTION"
- else
- DEVNAME="$ASELECTION"
- MNTPNT="`mount | grep "$BLKDEV" | tr -s " " | cut -f 3 -d " "`"
- [ -z "$MNTPNT" -o -f "$MNTPNT/initrd.gz" -a -f "$MNTPNT/$PUPPYSFS" ] && FILT_SELECTIONS="$FILT_SELECTIONS $BLKDEV $DEVNAME"
- fi
- done
- SELECTIONS="$FILT_SELECTIONS"
- if [ -z "$SELECTIONS" ];then
- m_14_3="$(gettext 'Puppy live-CD or virtual CD was not found.')
- $(eval_gettext "(No CD or .iso file has both 'initrd.gz' and '${PUPPYSFS}'.)")"
- Xdialog --wrap --left --title "$m_01: $m_02" --msgbox "$m_14_3" 0 0
- exit
- fi
- fi #130308 end of filter
- m_14_1="$(gettext 'Choose the CD/DVD drive...')"
- DIALOG="Xdialog --wrap --left --title \"$m_01\" --stdout --menubox \"$MSG\n\n$m_14_1\" 0 56 4 $SELECTIONS 2> /dev/null"
- BURNERDRV=""
- RESULT=$(eval $DIALOG) #w018 # 22jun09
- [ $? -ne 0 ] && exit
- BURNERDRV=$RESULT
- [ "$BURNERDRV" = "" ] && exit
- BURNERDRV="`echo -n "$BURNERDRV" | cut -f 3 -d '/'`"
- }
- #LANG=C #faster, plus Xdialog happier.
- KERNELVER="`uname -r`"
- #variables created at bootup by /initrd/usr/sbin/init...
- . /etc/rc.d/PUPSTATE
- [ "$PUP_LAYER" = "" ] && PUP_LAYER="/pup_ro2"
- . /etc/DISTRO_SPECS
- PUPPYSFS="$DISTRO_PUPPYSFS" #ex: puppy.sfs
- PUPSFS_ROOT="${PUPPYSFS%.sfs}"
- ZDRVSFS="$DISTRO_ZDRVSFS" #ex: zdrv.sfs
- SFSBASE="`basename $PUPPYSFS .sfs`" #ex: puppy
- PPATTERN="/initrd${PUP_LAYER}"
- if [ "`mount | grep "$PPATTERN"`" = "" ];then
- #no puppy.sfs file mounted on pup_ro2, probably h.d. install...
- m_03="$(eval_gettext 'This program requires a ${PUPPYSFS} file mounted on /initrd${PUP_LAYER}.')
- $(gettext 'Which is not the case here, probably because this is a full hard drive installation?')
- $(gettext 'Whatever, boot Puppy from live-CD and then you will be able to use this script.')
- $(eval_gettext 'Note, I have not tried it, but if you setup the situation of ${PUPPYSFS} mounted on directory /initrd${PUP_LAYER}, that will be acceptable for this program.')
- $(gettext 'You will also need a current live-CD, as the program gets files off it.')
- $(gettext 'Anyone want to try it?')
- $(gettext "Click 'Ok' button to quit...")"
- Xdialog --wrap --left --title "m_01: m_02" --msgbox "$m_03" 0 80
- exit
- fi
- SAVEPART="$PDEV1" #from PUPSTATE.
- CDR="/dev/$SAVEPART"
- #choose where to create isolinux-builds/ directory...
- m_05="$(gettext 'Welcome! This little program takes a snapshot of your current system and create a ISO file.')
- $(eval_gettext 'A Puppy live-CD has 4 main files: vmlinuz, isolinux.cfg, initrd.gz and ${PUPPYSFS}. Note, in some builds of Puppy there may also be a 5th file, ${ZDRVSFS}.')
- $(eval_gettext "It is \${PUPPYSFS} that mainly interests us here: it has the entire Puppy filesystem, everything from '/' down. What this script does is rebuild this file \${PUPPYSFS}, with everything currently under '/' -- that is, all user-installed packages, all mounted .sfs extension files, everything, gets combined into one file, \${PUPPYSFS}.")
- $(eval_gettext "Note, if you have an 'underdog Linux' mounted, that too will get combined into the \${PUPPYSFS} file, so beware, it could get big!")
- $(gettext 'Click OK button to continue (or close window to quit)...')"
- Xdialog --wrap --left --title "$m_01" --msgbox "$m_05" 0 80
- [ $? -ne 0 ] && exit
- #calc size needed...
- m_06="$(gettext 'Calculating needed working space.')
- $(gettext 'Please wait, this may take awhile...')"
- Xdialog --wrap --left --title "$m_01" --no-buttons --ignore-eof --infobox "$m_06" 0 0 0 &
- XPID=$!
- SIZEOPT=0
- SIZEBIN=`du -sk /bin | cut -f 1`
- SIZESBIN=`du -sk /sbin | cut -f 1`
- SIZELIB=`du -sk /lib | cut -f 1`
- SIZEUSR=`du -sk /usr | cut -f 1`
- SIZEOPT=0 # 01jul09
- [ -d /opt ] && SIZEOPT=`du -sk /opt | cut -f 1`
- sync
- SIZETOTALK=`LANG=C dc $SIZEBIN $SIZESBIN + $SIZELIB + $SIZEUSR + $SIZEOPT + p`
- SIZETOTALM=`LANG=C dc $SIZETOTALK 1024 \/ p| cut -d'.' -f1` # 01jul09
- [ "$SIZETOTALM" ] || SIZETOTALM=1
- #estimate a compressed size...
- SIZENEEDEDM=`expr $SIZETOTALM \/ 3`
- SIZESLACKM=`expr $SIZENEEDEDM \/ 3` #guess
- SIZENEEDEDM=`expr $SIZENEEDEDM + $SIZESLACKM`
- SIZENEEDEDM=`expr $SIZENEEDEDM + 25` #space for vmlinuz, initrd.gz, zdrv, etc
- #now choose working partition... v431 add ext4... 130216 add f2fs...
- PARTSLIST="`probepart -m 2> /dev/null | grep '^/dev/' | grep -E 'f2fs|ext2|ext3|ext4|reiserfs|btrfs|minix|msdos|vfat|exfat|ntfs' | cut -f 1-3 -d '|'`"
- if [ -z "$WKGPART" ]; then
- echo -n "" > "${TMP}"/schoices.txt
- echo "$PARTSLIST" |
- while read APART
- do
- [ "$APART" = "" ] && continue #v3.01 preaution
- MNTSTATUS="($m_07)" #"currently mounted"
- ATAG="`echo -n "$APART" | cut -f 1 -d '|' | cut -f 3 -d '/'`"
- ASIZE="`echo -n "$APART" | cut -f 3 -d '|'`"
- AFS="`echo -n "$APART" | cut -f 2 -d '|'`"
- AFPATTERN="^/dev/$ATAG " #v3.01
- AFREE="`df -m | grep -m 1 "$AFPATTERN" | tr -s " " | cut -f 4 -d " "`"
- FLAG_RO='no' #v431
- if [ ! "$AFREE" ];then
- MNTSTATUS="($m_08)" #"not mounted"
- mkdir -p /mnt/$ATAG
- mount -t $AFS /dev/$ATAG /mnt/$ATAG > /dev/null 2>&1
- if [ $? -eq 0 ];then
- if [ "$ATAG" = "fd0" ];then
- FFREE=`df -k | grep -m 1 "$AFPATTERN" | tr -s " " | cut -f 4 -d " "`
- AFREE="`LANG=C dc $FFREE 1024 \/ p`"
- else
- AFREE="`df -m | grep -m 1 "$AFPATTERN" | tr -s " " | cut -f 4 -d " "`"
- fi
- [ "`mount | grep -m 1 "$AFPATTERN" | grep ' (rw'`" = "" ] && FLAG_RO='yes' #v431 make sure writable.
- umount /dev/$ATAG
- else #v431
- continue
- fi
- else
- [ "`mount | grep -m 1 "$AFPATTERN" | grep ' (rw'`" = "" ] && FLAG_RO='yes' #v431 make sure writable.
- fi
- [ "$FLAG_RO" = "yes" ] && continue #v431
- [ "$AFS" ] && echo "${ATAG} \"${m_09}: $AFS ${m_10}: ${ASIZE}M ${m_11}: ${AFREE}M ${MNTSTATUS}\" \\" >> "${TMP}"/schoices.txt #v3.01 added precaution. #130302 L18L
- done
- SCHOICES="`cat "${TMP}"/schoices.txt`"
- #add tmpfs ramdisk choice...
- SIZETMPFSM=`df -m | grep '^tmpfs' | grep -E "/initrd/pup_rw|/initrd/mnt/tmpfs" | tr -s " " | cut -f 4 -d " "`
- TMPFSMSG=''
- if [ "$SIZETMPFSM" != "" ];then
- TOTALTMPFSM=`df -m | grep '^tmpfs' | grep -E '/initrd/pup_rw|/initrd/mnt/tmpfs' | tr -s " " | cut -f 2 -d " "`
- if [ "$SCHOICES" = "" ];then #v3.01
- SCHOICES="ramdisk \"$m_09: tmpfs $m_10: ${TOTALTMPFSM}M $m_11: ${SIZETMPFSM}M ($m_07)\" \\"
- else
- SCHOICES="$SCHOICES
- ramdisk \"$m_09: tmpfs $m_10: ${TOTALTMPFSM}M $m_11: ${SIZETMPFSM}M ($m_07)\" \\"
- fi
- m_12="$(gettext 'Note 2: you can use the tmpfs ramdisk, which is in RAM, if it has enough space.')"
- TMPFSMSG="$m_12
- "
- fi
- [ "$SCHOICES" = "" ] && exit #precaution.
- m_13="$(gettext 'A working area is required in which to create the new live-CD iso file.')
- $(eval_gettext 'Here are the available partitions. You must choose one that has at least ${SIZENEEDEDM}M free space on it.') $(gettext 'You will need an extra 100 - 300MB space (whatever the size of ISO file is going to be).')
- $(eval_gettext 'If the partition that you would like to use has less than ${SIZENEEDEDM}M free space on it, you will need to quit this script and delete some files.')
- $(gettext 'Note 1: you can use a usb drive, but it needs to have been plugged in before running this script, so that it will get detected.')
- ${TMPFSMSG}
- $(gettext 'Highlight desired choice then click OK button...')"
- echo '#!/bin/sh' > "${TMP}"/savedlg
- echo -n "Xdialog --wrap --left --stdout --title \"$m_01\" --menubox \"$m_13\" 0 80 5 " >> "${TMP}"/savedlg
- echo "$SCHOICES" >> "${TMP}"/savedlg
- echo ' > "${TMP}"/tag.txt' >> "${TMP}"/savedlg
- chmod 755 "${TMP}"/savedlg
- kill $XPID
- "${TMP}"/savedlg
- [ $? -ne 0 ] && exit #130223
- WKGPART="`cat "${TMP}"/tag.txt`"
- echo "WKGPART=$WKGPART"
- [ "$WKGPART" = "" ] && exit
- fi #End selecting working partition.
- #now get the files off it...
- #firstly need working place to write to...
- [ "$WKGPART" = "ramdisk" ] && WKGMNTPT="/"
- WPATTERN="/dev/$WKGPART "
- if [ "$WKGMNTPT" = "" ] ; then
- WKGMNTPT="`mount | grep "$WPATTERN" | head -n 1 | tr -s " " | cut -f 3 -d " "`"
- fi
- if [ "$WKGMNTPT" = "" ];then
- PPATTERN="^$WKGPART "
- WKGFS="`echo "$SCHOICES" | grep "$PPATTERN" | cut -f 2 -d ':' | cut -f 2 -d " "`"
- [ "$WKGFS" = "msdos" ] && WKGFS="vfat"
- mkdir -p /mnt/$WKGPART
- mount -t $WKGFS /dev/$WKGPART /mnt/$WKGPART
- [ $? -ne 0 ] && exit #precaution.
- WKGMNTPT="/mnt/$WKGPART"
- fi
- [ "$WKGMNTPT" = "/" ] && WKGMNTPT=""
- # reuse if sfs file already exists
- NEW="yes"
- [ -z "$ISO_ROOT_new" ] && ISO_ROOT_new="$WKGMNTPT/puppylivecdbuild"
- SFSPATH=$(ls -1 "${ISO_ROOT_new}/$PUPPYSFS" 2>/dev/null)
- if [ ! -z "$MK_NEW_ISO_ROOT" ]; then
- NEW="$MK_NEW_ISO_ROOT"
- elif [ "$SFSPATH" != "" -a $(echo "$SFSPATH" | wc -l) -eq 1 ]; then
- m_35="$(eval_gettext '${SFSPATH} found.')
- $(gettext 'Do you want to reuse it without any change?')
- $(gettext "If uncertain, click the 'No' button")"
- Xdialog --wrap --left --title "$m_01" --ok-label "$Yes_lbl" --cancel-label "$No_lbl" --yesno "$m_35" 0 0 && NEW="no"
- fi
- SFSPATH=""
- #=================================================================
- if [ "$NEW" = "yes" ]; then ###### long skip if, cleating new sfs
- #130223 i think should wipe contents of "$ISO_ROOT_new"?
- if [ -d "${ISO_ROOT_new}" ];then
- [ -f "${ISO_ROOT_new}"/$PUPPYSFS ] && rm -f "${ISO_ROOT_new}"/$PUPPYSFS
- [ -f "${ISO_ROOT_new}"/$ZDRVSFS ] && rm -f "${ISO_ROOT_new}"/$ZDRVSFS
- m_41="$(eval_gettext 'Directory ${WKGMNTPT}/puppylivecdbuild already exists.')
- $(gettext "Normally, this would be created fresh, empty. However, it exists from a previous execution of 'remasterpup2' script (this program), with files in it. You may choose to leave these files in-place, for the current remaster. If uncertain, click the 'Erase' button.")
- $(gettext 'Note, if you choose to retain the files: The next operation is this script will will read files from a CD, however they will not over-write existing files. Therefore, any customised files will be retained.')
- $(gettext "WARNING: If the files in 'puppylivecdbuild' are for a different version of Puppy, click the 'Erase' button.")
- $(gettext "Again, warning, if at all uncertain, click the 'Erase' button.")
- $(gettext "Click 'Keep' button to retain the files...")
- $(gettext "Click 'Erase' button to delete the files...")"
- lbl_41="$(gettext 'Keep')"
- lbl_42="$(gettext 'Erase')"
- Xdialog --wrap --left --title "$m_01" --ok-label "$lbl_41" --cancel-label "$lbl_42" --yesno "$m_41" 0 80
- [ $? -ne 0 ] && rm -rf "${ISO_ROOT_new}"
- fi
- #130222
- #130307 notice, line 356 "WARNING:....", the $ is not backslashed, which is confusing...
- m_42=""
- #if [ -d "${ISO_ROOT_new}" ];then #TODO: s243a need to decide where to close this if.
- m_42="$(gettext 'NOTICE:')
- $(eval_gettext 'Directory ${WKGMNTPT}/puppylivecdbuild already exists.')
- $(gettext 'If you want to re-use the files in it, and not re-read files from the CD (or virtual-CD), just click the window close-box to bypass this operation.')
- $(gettext '(You may view the directory contents with a file-manager to satisfy yourself whether these files should be re-used)')"
- fi
- if [ -z "$ISO_ROOT_old" ]; then
- m_40="$(gettext 'This remaster program needs to read some files off the current live-CD.')
- $(gettext "However, if a CD-image file (which has filename extension .iso) is mounted, the files may be read from that. We refer to this as a 'virtual CD'. To mount a virtual CD, just click on a .iso file.")
- $(eval_gettext "WARNING: Be sure that the live-CD or .iso file is the correct one for the currently running Puppy, which is '\${DISTRO_NAME}', version \${DISTRO_VERSION}. As a check, it must have in it the file '\${DISTRO_PUPPYSFS}'")
- $(gettext "If you want to read the files off a .iso file rather than a CD/DVD, please click on the .iso file right now (before clicking the 'OK' button below)")
- $(gettext "Alternatively, if you want to read the files off a Puppy live-CD, insert it in drive, then click 'OK' button.")${m_42}"
- Xdialog --wrap --left --title "$m_01" --msgbox "$m_40" 0 80
- if [ $? -eq 0 ];then #130223 big if "BIGIF2"
- #130222 fix this...
- VIRTUALCD=""
- #130301 crap, earlier was using losetup-FULL from util-linux git, now using older 2.21.1, it needs -a param,
- #but also truncates long lines (same as bb losetup) -- what a nuisance...
- for ONELOOP in `cat /proc/mounts | grep -E '(^/dev/loop.*)( udf | iso9660 )' | cut -f 1 -d ' ' | tr '\n' ' '` #130308 /dev/loop only
- do
- oPTN="^${ONELOOP} "
- ONEISO="$(cat /proc/mounts | grep "$oPTN" | cut -f 2 -d ' ' | rev | cut -f 1 -d '+' | cut -f 1 -d '/' | rev)" #130301
- [ "$ONEISO" = "" ] && continue #130301 precaution.
- ONELOOP=$(echo "$ONELOOP" | sed 's|/loop/|/loop|')
- VIRTUALCD="${VIRTUALCD} ${ONELOOP} ${ONEISO}"
- done
- m_14="$(gettext 'This remaster program needs to read some files off the current live-CD.')
- $(gettext 'You can also use a .iso file if it is already mounted as a virtual CD (you would need to have previously clicked on a .iso file to mount it).')"
- MSG="$m_14"
- choice_cdd filter #130308 Use filtering.
- CDPATTERN="/dev/$BURNERDRV "
- CDMNTPT="`mount | grep "$CDPATTERN" | tr -s " " | cut -f 3 -d " "`"
- if [ "$CDMNTPT" != "" ];then
- if [ ! -f $CDMNTPT/initrd.gz ];then #130308 In theory, this will now never be true.
- #091212 weird bug, no processes but when run this, x restarts...
- xFUSER="`fuser -m /dev/$BURNERDRV 2>/dev/null`" #do this first, seems to fix it.
- [ "$xFUSER" != "" ] && fuser -k -m /dev/$BURNERDRV
- sync
- umount /dev/$BURNERDRV 2> /dev/null
- if [ $? -ne 0 ];then
- m_15="$(gettext 'Mounted CD, get rid of it before running this program!')"
- Xdialog --wrap --left --title "$m_02" --msgbox "$m_15" 0 0
- exit
- fi
- CDMNTPT=""
- fi
- fi
- if [ "$CDMNTPT" = "" ];then
- m_16="$(eval_gettext 'Please insert the current Puppy live-CD into drive ${BURNERDRV}.')
- $(gettext 'Then click OK...')"
- while [ 1 ];do
- Xdialog --wrap --left --title "$m_01" --msgbox "$m_16" 0 0
- [ $? -eq 0 ] || exit # 22jun09
- case $BURNERDRV in
- loop*) #ISO.. already mounted
- CDMNTPT=$(mount | grep "^/dev/$BURNERDRV " | cut -f 3 -d ' ')
- ;;
- *) #CD
- #now mount it...
- CDMNTPT="/mnt/$BURNERDRV"
- mkdir -p /mnt/$BURNERDRV
- mount -t iso9660 /dev/$BURNERDRV /mnt/$BURNERDRV
- [ $? -eq 0 ] && break
- ;;
- esac
- done
- fi
- #now get the files off it...
- m_17="$(eval_gettext 'Copying files from CD to ${WKGMNTPT}/puppylivecdbuild/, please wait...')"
- Xdialog --wrap --left --title "$m_01" --no-buttons --ignore-eof --infobox "$m_17" 0 0 0 &
- XPID=$!
- mkdir -p "${ISO_ROOT_new}"
- #now copy the files... # v431JP HTM, ICO, INF
- sync
- (
- cd $CDMNTPT
- for F in ${ZDRVSFS} vmlinuz initrd.gz grldr *efi* *EFI* *.c32 *.sh *.lst *.xpm *.jpg *.png *.bin *.cfg *.msg *.16 *.HTM* *.ICO *.INF help
- do
- #130223 -n means do not override an existing file... 130304 hmmm, -n not supported, use -u ...
- [ -e "$F" ] && cp -a -u $F "${ISO_ROOT_new}"/
- sync
- done
- )
- umount /dev/$BURNERDRV 2> /dev/null
- kill $XPID
- fi #end "BIGIF2"
- m_16_1="$(eval_gettext 'Do you like to make ${ZDRVSFS}, the separate driver file?')"
- Xdialog --wrap --left --title "$m_01" --default-no --ok-label "$Yes_lbl" --cancel-label "$No_lbl" --yesno "$m_16_1" 0 0
- [ $? -eq 0 ] && MKZDRV="yes" || MKZDRV=""
- [ $? -eq 255 ] && exit #130223
- # set compression
- /usr/lib/gtkdialog/box_yesno --yes-label "xz (default)" --no-label "gzip" --yes-first --info \
- --yes-icon "execute.svg" --no-icon "execute.svg" \
- "$m_01" "$(gettext 'You can use xz or gzip compression. Choose one...')"
- case $? in
- 1) COMP="-comp gzip" ;;
- *) COMP="-comp xz -Xbcj x86" ;;
- esac
- #COMP="-noI -noD -noF -noX" #fast tests zzzzzz
- echo "COMP=${COMP}"
- # -
- m_18="$(eval_gettext 'Creating the ${PUPPYSFS} file in ${WKGMNTPT}/puppylivecdbuild/.')
- $(gettext 'This can take quite a long time, so please wait.... and wait...')
- $(eval_gettext 'This window will disappear when ${PUPPYSFS} is finally created.')
- $(gettext 'Please wait...')"
- Xdialog --wrap --left --title "$m_01" --no-buttons --ignore-eof --infobox "$m_18" 0 0 0 &
- XPID=$!
- #create new puppy.sfs file...
- squash() {
- echo $0 $@
- rxvt -bg orange -fg black -title "$m_01" -geometry 80x6 -e mksquashfs $@ 2> /dev/null
- }
- fk_squash() {
- echo $0 $@
- #s243a: use set -x to echo cpio commands in fk_mksquashfs and pass to rxvt
- #rxvt -bg orange -fg black -title "$m_01" -geometry 80x6 -e mksquashfs $@ 2> /dev/null
- fk_mksquashfs $@ #Short term hack
- }
- do_squash(){
- if [ "$mode" = dir ]; then
- fk_squash $@
- else
- squash $@
- fi
- }
- fk_mksquashfs(){
- #source_dir=$1; shift
- #target_dir=$2; shift
- option=""
- out=() #Currently not used
- args=()
- declare -A exludes
- for arg in "$@";do
- if [[ "$arg" == -* ]]; then
- case "$arg" in
- -*)
- option="$arg" ;;
- esac
- else
- case option in
- -e)
- exludes+=( ["$arg"]=1 ) ;;
- '')
- args+=( "$arg" ) ;;
- *)
- out+=( "$arg" ) ;;
- esac
- fi
- done
- n_args=${#args}
- target_dir=$args[$n_args]
- target_dir="${target_dir%.sfs}"
- mkdir -p "$target_dir"
- unset 'args[$n_args-1]' #https://stackoverflow.com/questions/8247433/remove-the-last-element-from-an-array
- #while read aDir; do
- if [ realpath "$target_dir" != "/" ]; then
- for aDir in "$args[@]"; do
- excluded="${excludes[$aDir]}"
- [ -z "$excluded" ] && excluded=0
- if [ ! $excluded -eq 1 ]; then
- cd $aDir
- cpio -pd "$target_dir"
- fi
- done
- fi
- #done < <(ls -a -1)
- }
- do_mksquashfs(){
- if [ "$mode" = dir ]; then
- fk_mksquashfs $@
- else
- mksquashfs $@
- fi
- }
- DIRHOME=""
- [ -d /home ] && DIRHOME="/home"
- [ -d /sys ] && DIRSYS="/sys"
- [ -d /lost+found ] && DIRLOST="/lost+found"
- rm -f ${WKGMNTPT}/puppylivecdbuild/$PUPPYSFS 2> /dev/null
- sync
- #note, /puppy.sfs is not normally there, i relocated it to a separate tmpfs,
- #however have not yet done that for multisession-cd/dvd (PUPMODE=77).
- #note, /home could be in underdog linux...
- # modules copied from initrd
- ANOTHER_REMOVE="/lib/modules/$KERNELVER/initrd /lib/modules/*/modules.*" # 28dec09 modules.*
- if [ "$MKZDRV" = "yes" ]; then
- rm -f "${ISO_ROOT_new}"/$ZDRVSFS 2> /dev/null
- do_mksquashfs /lib "${ISO_ROOT_new}"/$ZDRVSFS -keep-as-directory -e /lib/[^m]* $ANOTHER_REMOVE
- ANOTHER_REMOVE="/lib/modules"
- fi
- #120605 Omit certain /dev subdir content and modem components loaded from firmware tarballs...
- [ -d /dev/snd ] && [ "`ls /dev/snd`" != "" ] && DIRDEVSNDFILES="/dev/snd/*" #120721
- [ -d /dev/.udev ] && DIRDEVUDEV="/dev/.udev"
- #121021 modem daemons now left in place.
- [ -f /usr/share/icons/hicolor/icon-theme.cache ] && ICONCACHE=/usr/share/icons/hicolor/icon-theme.cache #120721
- TOPPLCDB=''
- [ -e /puppylivecdbuild ] && TOPPLCDB='/puppylivecdbuild'
- TOPPUPSFS=''
- [ -e /${PUPPYSFS} ] && TOPPUPSFS="/${PUPPYSFS}"
- # display terminal only for the first stage because it takes the most of time. 'squash' is a function, see above. 120512 $COMP added...
- do_squash / "${ISO_ROOT_new}"/$PUPPYSFS ${COMP} -e /media /etc /proc /initrd /var /tmp /archive /mnt /root $TOPPLCDB $ANOTHER_REMOVE $DIRHOME $DIRSYS $DIRLOST $TOPPUPSFS $DIRDEVSNDFILES $DIRDEVUDEV $ICONCACHE #120605 end #120721 avoid wildecards option, icon-theme.cache 121021
- sync
- #add pristine folders (out of current puppy.sfs)...
- do_mksquashfs /initrd${PUP_LAYER}/home "${ISO_ROOT_new}"/$PUPPYSFS -keep-as-directory
- sync
- do_mksquashfs /initrd${PUP_LAYER}/proc "${ISO_ROOT_new}"/$PUPPYSFS -keep-as-directory
- sync
- do_mksquashfs /initrd${PUP_LAYER}/tmp "${ISO_ROOT_new}"/$PUPPYSFS -keep-as-directory
- sync
- do_mksquashfs /initrd${PUP_LAYER}/mnt "${ISO_ROOT_new}"/$PUPPYSFS -keep-as-directory
- sync
- do_mksquashfs /initrd${PUP_LAYER}/media "${ISO_ROOT_new}"/$PUPPYSFS -keep-as-directory
- sync
- kill $XPID
- #######START WORKING ON /root#######
- for aUser in root spot fido puppy; do
- rm -rf "${TMP}""${aHome}" 2> /dev/null
- aHOME=$(eval echo "~$aUser")
- mkdir -p "${TMP}${aHome}"
- #do some work on "$aHome" before add it to the squashfs...
- cp -a /initrd${PUP_LAYER}"${aHome}" "${TMP}""${aHome}" #pristine "$aHome"
- #copy all of my-applications/
- cp -af "${aHome}"/my-applications/* "${TMP}${aHome}/my-applications/"
- #some dotpups get installed here...
- cp -af "${aHome}/my-roxapps" "${TMP}${aHome}/" 2>/dev/null
- #window manager config files...
- cp -af "${aHome}/.jwmrc" "${TMP}${aHome}/"
- cp -af "${aHome}/.jwmrc-tray" "${TMP}${aHome}/" #v411
- cp -af "${aHome}/.fvwm95rc" "${TMP}${aHome}/"
- cp -af "${aHome}/.icewm/menu" "${TMP}${aHome}/.icewm/"
- #rox desktop settings...
- cp -af "${aHome}/Choices/ROX-Filer/PuppyPin" "${TMP}${aHome}/Choices/ROX-Filer/"
- cp -af "${aHome}/Choices/ROX-Filer/globicons" "${TMP}${aHome}/Choices/ROX-Filer/"
- #100117 user changes get saved here, which overrides original...
- if [ -f "${aHome}/.config/rox.sourceforge.net/ROX-Filer/globicons" ];then
- mkdir -p "${TMP}${aHome}/.config/rox.sourceforge.net/ROX-Filer/"
- cp -af "${aHome}/.config/rox.sourceforge.net/ROX-Filer/globicons" "${TMP}${aHome}/.config/rox.sourceforge.net/ROX-Filer/"
- fi
- #100117 i think also save user settings...
- if [ -f "${aHome}/.config/rox.sourceforge.net/ROX-Filer/Options" ];then
- mkdir -p "${TMP}${aHome}/.config/rox.sourceforge.net/ROX-Filer/"
- cp -af "${aHome}/.config/rox.sourceforge.net/ROX-Filer/Options" "${TMP}${aHome}/.config/rox.sourceforge.net/ROX-Filer/"
- fi
- #v411 tidy up, remove desktop drive icons...
- grep -v '"${TMP}"/pup_event_frontend/drive_' "${TMP}${aHome}/Choices/ROX-Filer/PuppyPin" > "${TMP}"/remaster-PuppyPin
- mv -f "${TMP}/remaster-PuppyPin" "${TMP}${aHome}/Choices/ROX-Filer/PuppyPin"
- #this may have been modified for a different w.m...
- cp -af "${aHome}/.xinitrc" "${TMP}${aHome}/"
- #also this...
- [ -f "${aHome}/.xset.sh" ] && cp -af "${aHome}/.xset.sh" "${TMP}/root/"
- #v411 gtk theme may have been changed...
- cp -af "${aHome}/.gtkrc-2.0" "${TMP}${aHome}/"
- #v411 jwm theme may have changed...
- cp -af "${aHome}/.jwm/jwmrc-personal" "${TMP}${aHome}/.jwm/"
- cp -af "${aHome}/.jwm/jwmrc-personal2" "${TMP}${aHome}/.jwm/"
- cp -af "${aHome}/.jwm/jwmrc-theme" "${TMP}${aHome}/.jwm/"
- #v411 pmount preferences...
- cp -af "${aHome}/.pmountauto" "${TMP}${aHome}"/
- cp -af "${aHome}/.pmountengine" "${TMP}${aHome}"/
- cp -af "${aHome}/.pmountquit" "${TMP}${aHome}"/
- cp -af "${aHome}/.pmountsingle" "${TMP}${aHome}"/
- if [ -d /var/packages ]; then
- PKGS_DIR=/var/packages
- else
- PKGS_DIR="$(realpath "${aHome}/.pacakges")"
- fi
- if [ -e "$PKGS_DIR/package-files" ]; then
- PKG_FILES_DIR="$(realpath "$PKGS_DIR/package-files")"
- else
- PKG_FILES_DIR="$PKGS_DIR"
- fi
- if [ -d "$BUILTIN_FILES_DIR" \' ]; then
- BUILTIN_FILES_DIR="$PKGS_DIR/builtin_files"
- else
- BUILTIN_FILES_DIR="$(realpath "$PKGS_DIR/builtin_files")"
- fi
- #.packages/ .files, copy any files installed to "${aHome}"...
- echo -n "" > "${TMP}"/allpkgs.files
- #for ONEPKG in `ls -1 "$PKG_FILES_DIR/*.files" 2>/dev/null | tr "\n" " "`
- #do
- # grep '^'"$PKG_FILES_DIR" $ONEPKG | \
- #
- #modify "${aHome}"/.packages/ files, as all installed packages are now part of the new cd...
- cp -a -f "${aHome}/.packages" "${TMP}${aHome}/"
- #if [ ${PKG_FILES_DIR:0:5} = '"${aHome}"/' ]; then
- # while read -r ONEFILE
- # do
- # if [ -d "$ONEFILE" ] && [ ! -L "$ONEFILE" ];then #w018
- # mkdir -p ""${TMP}"${ONEFILE}"
- # fi
- # if [ -f "$ONEFILE" ] || [ -L "$ONEFILE" ];then #w018
- # DIRNAME="`dirname "$ONEFILE"`"
- # mkdir -p ""${TMP}"${DIRNAME}"
- # rm -f ""${TMP}"${ONEFILE}" # if ONEFILE already exists and it's a link, needs to be removed
- # cp -a -f "$ONEFILE" ""${TMP}"${DIRNAME}/"
- # fi
- # done < <(ls -1 "$PKG_FILES_DIR/*.files" 2>/dev/null)
- #fi
- #done
- #w018...
- # 141008: move *.files to ~/.packages/builtin_files/
- LH=$(("${#aHome}"+1))
- if [ ${PKG_FILES_DIR:0:$LH} = "${aHome}" ]; then
- touch "${aHome}/.packages/user-installed-packages"
- cat "${aHome}/.packages/user-installed-packages" | \
- while read -r ONEPKG
- do
- ONEFILE="${TMP}$PKG_FILES_DIR/"`echo "$ONEPKG" | cut -f1 -d '|'`.files
- ONENAME="${TMP}${aHome}/.packages/builtin_files/"`echo "$ONEPKG" | cut -f2 -d '|'`
- mv -f "$ONEFILE" "$ONENAME"
- done
- cat "${aHome}/.packages/user-installed-packages" >> "${TMP}${aHome}/.packages/woof-installed-packages"
- sort -u --key=1 --field-separator="|" "${TMP}${aHome}/.packages/woof-installed-packages" > "${TMP}/woof-installed-packages-tmp" #110722
- mv -f "${TMP}/woof-installed-packages-tmp" "${TMP}${aHome}/.packages/woof-installed-packages"
- echo -n "" > "${TMP}${aHome}/.packages/user-installed-packages" #v431
- fi
- sync #120607
- rm -f "${TMP}${aHome}/.packages/"*.files #120607
- rm -f "${TMP}${aHome}/.packages/"*.remove #120607
- [ -f "${TMP}${aHome}/.XLOADED" ] && rm -f "${TMP}${aHome}/.XLOADED" #130527
- done
- #######END WORKING ON "${aHome}" (Part #1)#######
- #######START WORKING ON /etc#######
- rm -rf "${TMP}"/etc 2> /dev/null
- #do some work on /etc before add it to the .sfs...
- cp -a /initrd${PUP_LAYER}/etc "${TMP}"/etc #pristine /etc.
- #maybe this has been modified...
- cp -af /etc/ld.so.conf "${TMP}"/etc/
- #.packages/ .files, copy any files installed to /etc...
- echo -n "" > "${TMP}"/allpkgs.files
- #for ONEPKG in `ls -1 "${aHome}"/.packages/*.files 2>/dev/null | tr "\n" " "`
- #do
- # grep '^/etc/' $ONEPKG | \
- # while read -r ONEFILE
- # do
- # if [ -d "$ONEFILE" ] && [ ! -L "$ONEFILE" ];then #w018
- # mkdir -p ""${TMP}"${ONEFILE}"
- # fi
- # if [ -f "$ONEFILE" ] || [ -L "$ONEFILE" ];then #w018
- # DIRNAME="`dirname "$ONEFILE"`"
- # mkdir -p ""${TMP}"${DIRNAME}"
- # rm -f ""${TMP}"${ONEFILE}" # if ONEFILE already exists and it's a link, needs to be removed
- # cp -a -f "$ONEFILE" ""${TMP}"${DIRNAME}/"
- # fi
- # done
- #done
- sync
- cp -af /etc/eventmanager "${TMP}"/etc/ #v411
- #what about settings for a particular pc?...
- m_20="$(gettext 'Hardware customisation was not chosen.')"
- MSG1="$m_20"
- m_21="$(eval_gettext 'Have created the /etc directory for the new ${PUPPYSFS} file.')
- $(gettext "It is in a 'pristine' state, but you can choose to customise it.")
- $(gettext "Do you want to add customisations for your hardware? Examples are mouse, keyboard, video. But, if you answer 'Yes' here, the live-CD will be preconfigured for your PC only. Therefore, it is best to answer 'No' if you want to boot the new live-CD on different PCs.")
- $(gettext "Click 'Yes' button to customise /etc...")
- $(gettext "Click 'No' button not to customise (recommended)...")"
- [ -z "$customize_etc" ]&& Xdialog --wrap --left --title "$m_01" --default-no --ok-label "$Yes_lbl" --cancel-label "$No_lbl" --yesno "$m_21" 0 80
- [ $? -eq 0 ] && customize_etc=yes || customize_etc=no
- if [ "$customize_etc" = yes ];then
- cp -af /etc/codepage "${TMP}"/etc/
- cp -af /etc/fontmap "${TMP}"/etc/
- cp -af /etc/keymap "${TMP}"/etc/
- cp -af /etc/mousedevice "${TMP}"/etc/
- cp -af /etc/eth0mode "${TMP}"/etc/
- cp -af /etc/eth1mode "${TMP}"/etc/
- cp -af /etc/resolv.conf "${TMP}"/etc/
- rm -f "${TMP}"/etc/localtime #a symlink
- cp -af /etc/localtime "${TMP}"/etc/
- cp -af /etc/TZ "${TMP}"/etc/
- cp -af /etc/cdburnerdevice "${TMP}"/etc/
- cp -af /etc/dvddevice "${TMP}"/etc/
- cp -af /etc/modemdevice "${TMP}"/etc/
- cp -af /etc/securetelnetrc "${TMP}"/etc/
- cp -af /etc/modules.conf "${TMP}"/etc/
- cp -af /etc/modprobe.d "${TMP}"/etc/ #101020
- cp -af /etc/rdesktoprc "${TMP}"/etc/
- cp -af /etc/windowmanager "${TMP}"/etc/
- cp -af /etc/X11/xorg.conf "${TMP}"/etc/X11
- cp -af /etc/network-wizard "${TMP}"/etc/
- cp -af /etc/simple_network_setup/* "${TMP}"/etc/simple_network_setup/
- m_22="$(gettext 'These files were customised in /etc:')
- codepage fontmap keymap mousedevice eth0mode eth1mode resolv.conf localtime TZ cdburnerdevice dvddevice modemdevice securetelnetrc modprobe.d/* rdesktoprc windowmanager X11/xorg.conf
- $(gettext 'Also these directories:')
- network-wizard."
- MSG1="$m_22"
- fi
- #some files to always copy...
- cp -af /etc/Puppybackgroundpicture "${TMP}"/etc/
- #TODO: other gtk and jwm customisations.
- cp -f "${TMP}"/etc/DISTRO_SPECS "${TMP}"/DISTRO_SPECSupdated #keep this to put into initrd.gz.
- #######END WORKING ON /etc (Part #1) #######
- #######START WORKING ON /var#######
- rm -rf "${TMP}"/var 2> /dev/null
- cp -a /initrd${PUP_LAYER}/var "${TMP}"/var #pristine var
- #.packages/ .files, copy any files installed to /var...
- echo -n "" > "${TMP}"/allpkgs.files
- #for ONEPKG in `ls -1 "$PKG_FILES_DIR/"*.files 2>/dev/null | tr "\n" " "`
- #do
- # grep '^/var/' $ONEPKG | \
- if [ ! -d /var/packages ]; then
- mkdir -p "${TMP}"/var #This is probably already done
- fi
- [ -d /var/packages ] && cp -arf --remove-destination /var/packages/* "${TMP}"/var/packages
- if [ ${PKG_FILES_DIR:0:5} = '/var/' ]; then
- #while read -r ONEFILE
- #do
- # if [ -d "$ONEFILE" ] && [ ! -L "$ONEFILE" ];then #w018
- # mkdir -p ""${TMP}"${ONEFILE}"
- # fi
- # if [ -f "$ONEFILE" ] || [ -L "$ONEFILE" ];then #w018
- # DIRNAME="`dirname "$ONEFILE"`"
- # mkdir -p ""${TMP}"${DIRNAME}"
- # rm -f ""${TMP}"${ONEFILE}" # if ONEFILE already exists and it's a link, needs to be removed
- # cp -a -f "$ONEFILE" ""${TMP}"${DIRNAME}/"
- # fi
- #done < <(ls -1 "$PKG_FILES_DIR/"*.files 2>/dev/null)
- #done
- # 141008: move *.files to ~/.packages/builtin_files/
- if [ ${PKG_FILES_DIR:0:5} = '/var/' ]; then
- touch "$PKGS_DIR/user-installed-packages"
- cat "$PKGS_DIR/user-installed-packages" | \
- while read -r ONEPKG
- do
- ONEFILE="${TMP}$PKG_FILES_DIR/`echo "$ONEPKG" | cut -f1 -d '|'`.files"
- ONENAME="$BUILTIN_FILES_DIR/`echo "$ONEPKG" | cut -f2 -d '|'`"
- mv -f "$ONEFILE" "$ONENAME"
- done
- fi
- #cat "$PKGS_DIR/user-installed-packages" >> "${TMP}$PKGS_DIR/woof-installed-packages"
- sort -u --key=1 --field-separator="|" "${TMP}"$PKGS_DIR/woof-installed-packages > "${TMP}"/woof-installed-packages-tmp #110722
- mv -f "${TMP}"/woof-installed-packages-tmp "${TMP}"$PKGS_DIR/woof-installed-packages
- echo -n "" > "${TMP}"$PKGS_DIR/user-installed-packages #v431
- sync #120607
- rm -f "${TMP}"$PKGS_DIR/*.files #120607
- rm -f "${TMP}"$PKGS_DIR/*.remove #120607
- fi
- sync
- [ "$CLEARPKGLOG" = "yes" ] && rm -f "${TMP}"/var/log/packages/* #120607
- #######END WORKING ON /var (Part #1)#######
- #######Start WORKING ON "${aHome}" (Part #2) #######
- for aUser in root spot fido puppy; do
- aHOME=$(eval echo "~$aUser")
- m_19="$(eval_gettext 'This program has created folder '"${TMP}${aHome}"', which has everything that is now going to be added as '"${aHome}"' in the ${PUPPYSFS} file.')
- $(gettext "This is mostly 'pristine', as obviously you do not want all your cache files, temp files, email files, and other working/temporary files to be the ISO. However, if you are familiar with the workings of Puppy, you might like to take a look at ${TMP}${aHome} right now, and possibly add anything that you want from ${aHome} (or remove something!)")
- $(gettext '(if you think that this program has missed out something important, please let us know..')
- $(eval_gettext "After examining ${TMP}${aHome}, click 'Ok' to add ${aHome} in \${PUPPYSFS} file...")"
- if -z "$root_action" ]; then
- Xdialog --wrap --left --title "$m_01" --msgbox "$m_19" 0 80
- else
- case "$root_action"
- default) cp_user_for_remaster ;;
- *) echo "Root action='$root_action' not yet defined"
- fi
- sync
- [ "$(ls "${TMP}${aHome}/.packages/"*.files)" = "" ] && CLEARPKGLOG="yes" || CLEARPKGLOG="no" #120607 in case user copied entire "${aHome}" to "${TMP}" for boot disk.
- do_mksquashfs "${TMP}${aHome}" "${ISO_ROOT_new}"/$PUPPYSFS -keep-as-directory
- sync
- rm -rf "${TMP}${aHome}"
- done
- #######END WORKING ON "${aHome}" (Part #2) #######
- #######Start WORKING ON /etc (Part #2) #######
- m_23="${MSG1}
- $(gettext 'If you know what you are doing, you can now modify any files in '"'"${TMP}'/etc'"'"' folder. This is just about to be added to /etc in the .sfs file.')
- $(gettext "Do anything you want before clicking 'Ok'.")
- $(gettext '(If this program has missed something important, let me know -- Barry Kauler)')
- $(eval_gettext "Click 'Ok' to add /etc in \${PUPPYSFS} file...")"
- if -z "$etc_action" ]; then
- Xdialog --wrap --left --title "$m_01" --msgbox "$m_23" 0 80
- else
- case "$etc_action"
- default) cp_etc_for_remaster ;;
- *) echo "Root action='$root_action' not yet defined"
- fi
- #120606 in case user just now replaced the /etc directory...
- sync
- #130527 .XLOADED moved to /root (see /usr/bin/xwin), change test...
- MODIFETC="$(find "${TMP}"/etc/modules -mindepth 1 -maxdepth 1 -name 'firmware.dep.inst.*')"
- if [ "$MODIFETC" != "" ];then
- #rm -f "${TMP}"/etc/.XLOADED
- rm -f "${TMP}"/etc/modules/firmware.dep.inst.*
- touch "${TMP}"/etc/personal_settings_popup_disabled
- touch "${TMP}"/etc/personal_data_save_disabled
- fi
- [ -f "${TMP}"/etc/.XLOADED ] && rm -f "${TMP}"/etc/.XLOADED #130527 just in case old file still there.
- sync
- do_mksquashfs "${TMP}/etc" "${ISO_ROOT_new}"/$PUPPYSFS -keep-as-directory
- sync
- rm -rf "${TMP}"/etc
- #######END WORKING ON /etc (Part #2) #######
- #######Start WORKING ON /var (Part #2) #######
- sync
- do_mksquashfs "${TMP}"/var "${ISO_ROOT_new}"/$PUPPYSFS -keep-as-directory
- sync
- rm -rf "${TMP}"/var
- #s243a: TODO: add prompt to modify the var folder like was done in the etc folder
- #######END WORKING ON /var#######
- chmod a+r "${ISO_ROOT_new}"/* &>/dev/null
- chmod a-x "${ISO_ROOT_new}"/*.sfs &>/dev/null
- fi ###### end of long skip if, cleating new sfs
- #=================================================================
- m_25="$(gettext 'Almost ready to create the new ISO file!')
- $(gettext "If you want to add any more files, say extra SFS files, or to edit or modify the files in any way, do it now. Note, if you add an extra SFS file, say 'devx.sfs' then it will be available for use when you boot the new live-CD.")
- $(eval_gettext "If you want to make any changes, use ROX-Filer to open \${WKGMNTPT}/puppylivecdbuild/ and do so now, before clicking the 'OK' button.")"
- Xdialog --wrap --left --title "$m_01" --msgbox "$m_25" 0 80
- sync
- BOOTLOADER=""
- [ -f "${ISO_ROOT_new}"/grldr ] && BOOTLOADER="grldr"
- [ -f "${ISO_ROOT_new}"/isolinux.bin ] && BOOTLOADER="isolinux.bin"
- if [ "$BOOTLOADER" = "" ]; then
- m_25_1="$(gettext 'No boot loaders found. You need isolinux.bin or grldr to make bootable CD.')
- $(gettext "Click 'OK' to quit.")
- $(eval_gettext '(leaving ${WKGMNTPT}/puppylivecdbuild/ files in existence)')"
- Xdialog --wrap --left --title "$m_01" --msgbox "$m_25_1" 0 0
- exit
- fi
- if [ "$NEW" = "yes" ]; then #120628: no change id-string for reuse
- sync
- #100913 need to update file DISTRO_SPECS in initrd.gz, so init script can find puppy files...
- mv -f "${ISO_ROOT_new}"/initrd.gz "${TMP}" #note $WKGMNTPT may be non-linux fs.
- cd "${TMP}"
- gunzip initrd.gz
- mkdir initrd-tree-tmp1
- cd initrd-tree-tmp1
- cat ../initrd | cpio -i -d -m
- sync
- rm -f ../initrd
- cp -a -f "${TMP}"/DISTRO_SPECSupdated ./DISTRO_SPECS #see earlier.
- find . | cpio -o -H newc | gzip -9 > "${ISO_ROOT_new}"/initrd.gz
- sync
- cd ..
- rm -rf initrd-tree-tmp1
- cd /root
- fi #120628 end
- if [ -f "${ISO_ROOT_new}"/efi.img ] ; then
- EFI_IMG='efi.img'
- fi
- #build new iso file
- MSG="$(gettext 'ISO file not created.')"
- m_27="$(eval_gettext "Click 'Yes' button to create a 'custom-puppy.iso' in \${WKGMNTPT}/ (assuming that there is 100MB-300MB free space)...")
- $(eval_gettext "Click 'No' button (or close-box on window) to quit program at this point (leaving \${WKGMNTPT}/puppylivecdbuild/ files in existence)...")"
- Xdialog --wrap --left --title "$m_01" --ok-label "$Yes_lbl" --cancel-label "$No_lbl" --yesno "$m_27" 0 80
- if [ $? -eq 0 ];then
- VOLI=""
- m_27_1="$(gettext 'You can add the CD volume ID.')"
- VOLI=$(Xdialog --title "$m_01" --stdout --inputbox "$m_27_1" 0 60 "$SFSBASE")
- [ "$VOLI" != "" ] && VOLI="-V $(echo "$VOLI"|tr ' ' '_')"
- rm -f $WKGMNTPT/custom-puppy*.iso
- #=
- if [ "$EFI_IMG" ];then
- UEFI='-uefi'
- UEFI_OPT='-u'
- # make uefi iso
- rxvt -bg orange -fg black -title "$m_01" -e \
- mkisofs -iso-level 4 -D -R $VOLI -o $WKGMNTPT/custom-puppy${UEFI}.iso \
- -b ${BOOTLOADER} -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
- -eltorito-alt-boot -eltorito-platform efi -b "$EFI_IMG" -no-emul-boot \
- "${ISO_ROOT_new}"/
- else
- rxvt -bg orange -fg black -title "$m_01" -e \
- mkisofs -iso-level 4 -D -R $VOLI -o $WKGMNTPT/custom-puppy.iso \
- -b ${BOOTLOADER} -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
- "${ISO_ROOT_new}"/
- fi
- case $BOOTLOADER in *"isolinux"*)
- if which isohybrid ; then
- echo "isohybrid ${UEFI_OPT} $WKGMNTPT/custom-puppy${UEFI}.iso"
- isohybrid ${UEFI_OPT} "$WKGMNTPT/custom-puppy${UEFI}.iso"
- fi ;;
- esac
- MSG="$(eval_gettext '${WKGMNTPT}/custom-puppy${UEFI}.iso created.')"
- fi
- sync
- m_28="$(eval_gettext '${WKGMNTPT}/puppylivecdbuild/ files left in existence.')
- $(gettext "Click 'Ok' button to quit...")"
- Xdialog --wrap --left --title "$m_01" --msgbox "$MSG
- $m_28" 0 0
- ### END ###
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement