1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101 |
- #!/bin/sh
- if [ ! $1 ];then
- mount -t proc none /proc
- mount -t sysfs none /sys
- mount -t rootfs -o remount,rw rootfs /
- ln -s /proc/mounts /etc/mtab
- [ $plang ] && PLANG=$plang
- [ "`echo -n "$PLANG" | grep '_'`" = "" ] && PLANG=""
- [ ! "$PLANG" ] && [ -f /PUPPYLANG ] && PLANG=`cat /PUPPYLANG`
-
- if [ "$PLANG" ];then
- if [ -f /locale/${PLANG%.*}/init ];then
- TRANSLATIONFILE="/locale/${PLANG%.*}/init"
- else
- [ -f /locale/${PLANG%_*}/init ] && TRANSLATIONFILE="/locale/${PLANG%_*}/init"
- fi
- if [ "$TRANSLATIONFILE" ];then
- sed -f $TRANSLATIONFILE /init > /init2
- chmod 755 /init2
- exec /init2 $PLANG
- fi
- fi
- else
- PLANG=${1}
- fi
- export LANG=C
- . /DISTRO_SPECS
- [ ! "$DISTRO_DB_SUBNAME" ] && DISTRO_DB_SUBNAME="$DISTRO_COMPAT_VERSION"
- PATH="/bin:/sbin"
- KERNELVER="`uname -r`"
- PUPDESKFLG=1
- DEVTMPFSFLG=0
- ZDRVSFS="$DISTRO_ZDRVSFS"
- ADRVSFS="$DISTRO_ADRVSFS"
- YDRVSFS="$DISTRO_YDRVSFS"
- PUPXXXSFS="$DISTRO_PUPPYSFS"
- IDSTRING="$DISTRO_IDSTRING"
- [ "`echo "$PUPXXXSFS" | grep '[0-9]\.sfs'`" != "" ] && NAMETYPE='traditional'
- [ $layerfs ] && LAYERFS=$layerfs
- [ ! $LAYERFS ] && LAYERFS=aufs
- [ "`modinfo aufs 2>/dev/null`" = "" ] && LAYERFS=unionfs
- [ $loglevel ] && LOGLEVEL=$loglevel
- fsckme_func() {
- if [ ! -e /bin/e2fsck ];then
- echo -e -n "\\033[1;31m SORRY, cannot check filesystem \\033[0;39m" > /dev/console
- return
- fi
- [ "$DEEPFSCK" = "yes" ] && FCK="-f" || FCK=""
- case $2 in
- ext2|ext3|ext4)
- e2fsck -y ${FCK} /dev/$1 >/tmp/chkret &
- echo -e "\\033[1;35m" >/dev/console
- if [ "${1}" = "loop1" ];then
- echo -n " 'save file' filesystem check, please wait..." >/dev/console
- else
- echo -n " '${1}' filesystem check, please wait..." >/dev/console
- fi
- usleep 200000
- while [ "`pidof e2fsck`" != "" ];do
- sleep 1
- echo -n "." >/dev/console
- done
- echo -en "\\033[0;39m" >/dev/console
- ;;
- esac
- if [ $3 ];then
-
-
-
-
-
- PFSCK="yes"
- fi
- }
- mntfunc() {
- MNT_T="$1"
- MNT_DEV="$2"
- MNT_DIR="$3"
- MNT_O=""
- [ $4 ] && MNT_O="${4}"
- case $MNT_T in
- ntfs)
- ntfs-3g $MNT_DEV $MNT_DIR -o umask=0,no_def_opts,noatime,rw,silent 2>/dev/null
- ntfsRETVAL=$?
- [ $ntfsRETVAL -eq 0 ] && return 0
- if [ $ntfsRETVAL -eq 14 ];then
- echo -e "\\033[1;31m" >/dev/console
- echo -n "ERROR: Windows NTFS hibernated partition, cannot mount" > /dev/console
- echo -e "\\033[0;39m" >/dev/console
- return 14
- else
- ntfs-3g $MNT_DEV $MNT_DIR -o umask=0,no_def_opts,noatime,rw,force,silent 2>/dev/null
- fi
- ;;
- vfat)
- mount -t $MNT_T -o $VFAT_OUT_PARAM $MNT_DEV $MNT_DIR
- ;;
- *)
- if [ "$MNT_O" = "" ];then
- mount -t $MNT_T $MNT_DEV $MNT_DIR
- else
- mount -t $MNT_T -o $MNT_O $MNT_DEV $MNT_DIR
- fi
- ;;
- esac
- return $?
- }
- umntfunc() {
-
-
- LASTPARAM="`echo -n "$*" | tr '\t' ' ' | tr -s ' ' | tr ' ' '\n' | grep '^/mnt/'`"
- if [ "`mount | grep "$LASTPARAM" | grep -E 'ntfs|fuse'`" = "" ];then
- umount $@
- else
- fusermount -u $LASTPARAM
- fi
- return $?
- }
- check_status()
- {
- if [ $1 -eq 0 ]
- then
- /bin/echo -en "\\033[74G" >/dev/console
- /bin/echo -en "\\033[1;32m" >/dev/console
- /bin/echo -en "done" >/dev/console
- /bin/echo -e "\\033[0;39m" >/dev/console
- else
- /bin/echo -en "\\033[72G" >/dev/console
- /bin/echo -en "\\033[1;31m" >/dev/console
- /bin/echo -en "failed" >/dev/console
- /bin/echo -e "\\033[0;39m" >/dev/console
- echo -en "\\033[1;35m" >/dev/console
- echo -n "Dumping last lines of /tmp/bootinit.log..." >/dev/console
- /bin/echo -e "\\033[0;39m" >/dev/console
- echo -en "\\033[1;31m" >/dev/console
- cat /tmp/bootinit.log | tail -n 4 >/dev/console
- /bin/echo -en "\\033[0;39m" >/dev/console
- echo -en "\\033[1;35m" >/dev/console
- echo -n "Dumping last lines of kernel log..." >/dev/console
- /bin/echo -e "\\033[0;39m" >/dev/console
- echo -en "\\033[1;31m" >/dev/console
- dmesg | tail -n 4 >/dev/console
- /bin/echo -en "\\033[0;39m" >/dev/console
-
- [ "$RDSH" != "" ] && exec /bin/sh >/dev/console 2>&1
- echo "Pausing for 60 seconds..." >/dev/console
- sleep 60
- fi
- }
- search_func() {
- case $1 in
- ata)
- [ "$PMEDIA" = "usbflash" -o "$PMEDIA" = "usbhd" ] && return
- LESSPARTS0="`echo "$PCPARTS0" | grep -f /tmp/ALLDRVS0`"
- ;;
- *)
- LESSPARTS0="`echo "$PCPARTS0" | grep -v -f /tmp/ATADRIVES0`"
- ;;
- esac
- if [ "$PMEDIA" ];then
- case $PMEDIA in
- cd)
- [ "$PRAMONLY" = "yes" ] && LESSPARTS0="`echo "$LESSPARTS0" | grep -E 'iso9660|udf'`"
- ;;
- *)
-
- [ "$PDEV1" ] && LESSPARTS0="`echo "$LESSPARTS0" | grep "${PDEV1}|"`"
- ;;
- esac
- fi
- [ "$LESSPARTS0" = "" ] && return
- LESSPARTS="`echo "$LESSPARTS0" | tr '\n' ' '`"
- echo "$PCPARTSALL" > /tmp/PCPARTSALL_${1}
- echo "$LESSPARTS0" > /tmp/LESSPARTS0_${1}
-
-
- LINUXFS="$(echo "$LESSPARTS0" | grep -E 'ext2|ext3|ext4|reiserfs|minix|f2fs' | head -n 1)"
-
-
- IGNORE=''
- SEARCHDEPTH=2
- [ "$PSUBDIR" ] && SEARCHDEPTH=1
- for ONETRY in $LESSPARTS
- do
- ONEDEV="`echo -n "$ONETRY" | cut -f 1 -d '|'`"
- ONEFS="`echo -n "$ONETRY" | cut -f 2 -d '|'`"
- ONEDRV="`echo -n "$ONEDEV" | grep -o -f /tmp/ALLDRVS0`"
- if [ "$IGNORE" = "optical" ];then
- [ "`echo -n "$ONEDRV" | grep -f /tmp/OPTICALDRIVES0`" != "" ] && continue
- fi
- [ "$PFSCK" = "yes" ] && [ "$pdev1" = "$ONEDEV" ] && \
- [ "$(echo $ONEFS| cut -c 1-3)" = "ext" ] && fsckme_func $ONEDEV $ONEFS
-
- mntfunc $ONEFS /dev/$ONEDEV /mnt/data
- if [ $? -ne 0 ];then
- echo "PAUSE 5SEC: tried to mount /dev/${ONEDEV}, ${ONEFS} f.s."
- echo -e -n " \\033[1;31mpausing\\033[0;39m" > /dev/console
- sleep 5
- mntfunc $ONEFS /dev/$ONEDEV /mnt/data
- if [ $? -ne 0 ];then
- echo "RETRY FAILED: mounting /dev/${ONEDEV}, ${ONEFS} f.s."
- continue
- fi
- fi
- echo "ONEDEV=$ONEDEV ONEFS=$ONEFS ONEDRV=$ONEDRV PSUBDIR=$PSUBDIR" >> /tmp/puppy-file-search.log
-
- if [ -d /mnt/data${PSUBDIR} ];then
-
- if [ "$VMLINUZ" = "" ];then
- if [ "$ONEFS" != "iso9660" -a "$PMEDIA" = "cd" -a "$ONEFS" != "udf" ];then
- echo "Bypass looking for vmlinuz on $ONEDEV"
- else
- FND_FILES="`find /mnt/data${PSUBDIR} -maxdepth ${SEARCHDEPTH} -xdev -type f -iname kernel.qky -o -iname ${KERNELNAME} | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- for ONEPUPFILE in $FND_FILES
- do
- ONEFULLSIZE=`stat -c %s /mnt/data${ONEPUPFILE}`
- ONEORIGSIZE=`expr $ONEFULLSIZE - 32`
- ONEIDSTRING="`dd if=/mnt/data${ONEPUPFILE} bs=1 skip=${ONEORIGSIZE} 2>/dev/null | sed -e 's%[^a-zA-Z0-9\.]%%g'`"
- if [ "$ONEIDSTRING" = "$IDSTRING" ];then
- VMLINUZ="`basename $ONEPUPFILE`"
- PDEV1="$ONEDEV"
- DEV1FS="$ONEFS"
- BOOTDRV="$ONEDRV"
- PSUBDIR="`dirname $ONEPUPFILE`"
- [ "$PSUBDIR" = "/" ] && PSUBDIR=""
-
-
- [ -f /mnt/data${PSUBDIR}/SAVEMARK ] && PSAVEMARK="`cat /mnt/data${PSUBDIR}/SAVEMARK`"
- [ "$PSAVEMARK" ] && SAVEPART="${BOOTDRV}${PSAVEMARK}"
- [ "$PSUBDIR" = "" ] && [ -f /mnt/data/etc/DISTRO_SPECS ] && DEV1PUP='yes'
- if [ "`echo -n "$BOOTDRV" | grep -f /tmp/OPTICALDRIVES0`" = "" ];then
- IGNORE='optical'
- else
- FND_MULTIFOLDER="`find /mnt/data -maxdepth 1 -xdev -type d -name 20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9] | grep -v ' ' | sed -e 's%^/mnt/data%%' | head -n 1`"
- if [ "$FND_MULTIFOLDER" ];then
- if [ "$PRAMONLY" != "yes" ];then
- PUPMODE=72
- PUPSAVE="${ONEDEV},${ONEFS},${FND_MULTIFOLDER}"
- fi
- fi
- fi
- fi
- done
- fi
- fi
-
- [ "$PSUBDIR" ] && SEARCHDEPTH=1
-
- if [ "$PUPSFS" = "" ];then
- FND_FILES="`find /mnt/data${PSUBDIR} -maxdepth ${SEARCHDEPTH} -xdev -type f -iname ${PUPXXXSFS} | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- for ONEPUPFILE in $FND_FILES
- do
- if [ "$NAMETYPE" = "traditional" ];then
- ONEIDSTRING="$IDSTRING"
- else
- ONEFULLSIZE=`stat -c %s /mnt/data${ONEPUPFILE}`
- ONEORIGSIZE=`expr $ONEFULLSIZE - 32`
- ONEIDSTRING="`dd if=/mnt/data${ONEPUPFILE} bs=1 skip=${ONEORIGSIZE} 2>/dev/null | sed -e 's%[^a-zA-Z0-9\.]%%g'`"
- fi
- if [ "$ONEIDSTRING" = "$IDSTRING" ];then
- PUPSFS="${ONEDEV},${ONEFS},${ONEPUPFILE}"
- break
- fi
- done
- fi
-
- if [ "$ZDRV" = "" ];then
- FND_FILES="`find /mnt/data${PSUBDIR} -maxdepth ${SEARCHDEPTH} -xdev -type f -iname ${ZDRVSFS} | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- for ONEPUPFILE in $FND_FILES
- do
- if [ "$NAMETYPE" = "traditional" ];then
- ONEIDSTRING="$IDSTRING"
- else
- ONEFULLSIZE=`stat -c %s /mnt/data${ONEPUPFILE}`
- ONEORIGSIZE=`expr $ONEFULLSIZE - 32`
- ONEIDSTRING="`dd if=/mnt/data${ONEPUPFILE} bs=1 skip=${ONEORIGSIZE} 2>/dev/null | sed -e 's%[^a-zA-Z0-9\.]%%g'`"
- fi
- if [ "$ONEIDSTRING" = "$IDSTRING" ];then
- ZDRV="${ONEDEV},${ONEFS},${ONEPUPFILE}"
- break
- fi
- done
- fi
-
- if [ "$ADRV" = "" ];then
- FND_FILES="`find /mnt/data${PSUBDIR} -maxdepth ${SEARCHDEPTH} -xdev -type f -iname ${ADRVSFS} | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- for ONEPUPFILE in $FND_FILES
- do
- if [ "$NAMETYPE" = "traditional" ];then
- ONEIDSTRING="$IDSTRING"
- else
- ONEFULLSIZE=`stat -c %s /mnt/data${ONEPUPFILE}`
- ONEORIGSIZE=`expr $ONEFULLSIZE - 32`
- ONEIDSTRING="`dd if=/mnt/data${ONEPUPFILE} bs=1 skip=${ONEORIGSIZE} 2>/dev/null | sed -e 's%[^a-zA-Z0-9\.]%%g'`"
- fi
- if [ "$ONEIDSTRING" = "$IDSTRING" ];then
- ADRV="${ONEDEV},${ONEFS},${ONEPUPFILE}"
- echo -n " adrive" > /dev/console
- break
- fi
- done
- fi
-
- if [ "$YDRV" = "" ];then
- FND_FILES="`find /mnt/data${PSUBDIR} -maxdepth ${SEARCHDEPTH} -xdev -type f -iname ${YDRVSFS} | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- for ONEPUPFILE in $FND_FILES
- do
- if [ "$NAMETYPE" = "traditional" ];then
- ONEIDSTRING="$IDSTRING"
- else
- ONEFULLSIZE=`stat -c %s /mnt/data${ONEPUPFILE}`
- ONEORIGSIZE=`expr $ONEFULLSIZE - 32`
- ONEIDSTRING="`dd if=/mnt/data${ONEPUPFILE} bs=1 skip=${ONEORIGSIZE} 2>/dev/null | sed -e 's%[^a-zA-Z0-9\.]%%g'`"
- fi
- if [ "$ONEIDSTRING" = "$IDSTRING" ];then
- YDRV="${ONEDEV},${ONEFS},${ONEPUPFILE}"
- echo -n " ydrive" > /dev/console
- break
- fi
- done
- fi
-
- fi
- echo " IGNORE=$IGNORE PSUBDIR=$PSUBDIR SAVEPART=$SAVEPART VMLINUZ=$VMLINUZ PDEV1=$PDEV1 PUPSFS=$PUPSFS" >> /tmp/puppy-file-search.log
-
- FND_PUPSAVES=""
- ONEFS_IS_LINUX=""
- case $ONEFS in
- ext2|ext3|ext4|reiserfs|minix|f2fs) ONEFS_IS_LINUX="Y" ;;
- esac
- if [ "$SAVEPART" ];then
- if [ "$SAVEPART" = "$ONEDEV" ];then
- if [ "$PSUBDIR" ];then
-
- if [ -d /mnt/data${PSUBDIR} ]; then
- [ "$ONEFS_IS_LINUX" = "Y" ] && FND_PUPSAVES="`find /mnt/data${PSUBDIR} -maxdepth 1 -xdev -type d -iname ${DISTRO_FILE_PREFIX}save'*' | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- FND_PUPSAVES="${FND_PUPSAVES}`find /mnt/data${PSUBDIR} -maxdepth 1 -xdev -type f -iname ${DISTRO_FILE_PREFIX}save*.[234]fs | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- fi
- else
- [ "$ONEFS_IS_LINUX" = "Y" ] && FND_PUPSAVES="`find /mnt/data -maxdepth ${SEARCHDEPTH} -xdev -type d -iname ${DISTRO_FILE_PREFIX}save'*' | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- FND_PUPSAVES="${FND_PUPSAVES}`find /mnt/data -maxdepth ${SEARCHDEPTH} -xdev -type f -iname ${DISTRO_FILE_PREFIX}save*.[234]fs | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- [ -f /mnt/data/etc/rc.d/PUPSTATE ] && DEV2PUP="${ONEDEV}|${ONEFS}"
- fi
- fi
- else
- if [ "$PSUBDIR" ];then
-
- if [ -d /mnt/data${PSUBDIR} ]; then
- [ "$ONEFS_IS_LINUX" = "Y" ] && FND_PUPSAVES="`find /mnt/data${PSUBDIR} -maxdepth 1 -xdev -type d -iname ${DISTRO_FILE_PREFIX}save'*' | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- FND_PUPSAVES="${FND_PUPSAVES}`find /mnt/data${PSUBDIR} -maxdepth 1 -xdev -type f -iname ${DISTRO_FILE_PREFIX}save*.[234]fs | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- fi
- else
- [ "$ONEFS_IS_LINUX" = "Y" ] && FND_PUPSAVES="`find /mnt/data -maxdepth ${SEARCHDEPTH} -xdev -type d -iname ${DISTRO_FILE_PREFIX}save'*' | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- FND_PUPSAVES="${FND_PUPSAVES}`find /mnt/data -maxdepth ${SEARCHDEPTH} -xdev -type f -iname ${DISTRO_FILE_PREFIX}save*.[234]fs | grep -v ' ' | sed -e 's%^/mnt/data%%' | tr '\n' ' '`"
- fi
- fi
- [ "$FND_PUPSAVES" ] && echo "$ONEDEV $ONEFS $FND_PUPSAVES" >> /tmp/PUPSAVES
-
-
- if [ "$PRAMONLY" != "yes" -a $PUPDESKFLG -eq 1 ];then
- if [ ! -f /tmp/RWPART ];then
- if [ "$LINUXFS" ];then
- RWPARTFLG=''
- case $ONEFS in
- ext2|ext3|ext4|reiserfs|minix|f2fs) RWPARTFLG="$(cat /proc/mounts | grep "/dev/${ONEDEV} " | grep ' rw,')" ;;
- esac
- else
- RWPARTFLG="$(cat /proc/mounts | grep "/dev/${ONEDEV} " | grep ' rw,')"
- fi
- [ "$RWPARTFLG" ] && echo -n "${ONEDEV}|${ONEFS}" > /tmp/RWPART
- fi
- fi
-
-
- FSCKME=""
- [ -f /mnt/data/fsckme.flg ] && FSCKME="`cat /mnt/data/fsckme.flg | tr ',' ' ' | tr '\n' ' '`" \
- && DEEPFSCK="yes"
- rm -f /mnt/data/fsckme.flg
- umntfunc /mnt/data
- [ "$FSCKME" ] && fsckme_func $FSCKME
- done
- }
- resize_pupsave_func() {
- rm -f /mnt/dev_save/pupsaveresizenew.txt
- echo > /dev/console
- echo -n "Increasing $PUPSAVEFILE by $KILOBIG Kbytes, please wait..." >/dev/console
- dd if=/dev/zero bs=1024 count=$KILOBIG >> /mnt/dev_save$PUPSAVEFILEX
- sync
- }
- fsck_pupsave_func() {
- e2fsck -y -f $1
- resize2fs -pf $1
- sync
- check_status 0
- echo -n "...continuing with loading $PUPSAVEFILE..." > /dev/console
- }
- mnt_enc_pupsave_func() {
- echo >/dev/console
- echo "NOTICE: As you type your password nothing will be displayed on the screen." >/dev/console
- echo "This is a security measure. Just type it in then press ENTER key..." >/dev/console
- echo -e "\\033[1;36m" >/dev/console
- echo -n "Password: " >/dev/console
- echo -en "\\033[0;39m" >/dev/console
- oldIFS="$IFS"; IFS=
- read -s -r MYPASS
- IFS="$oldIFS"
- if [ "$CRYPTO" = "-e aes" ];then
- echo "$MYPASS" | losetup -p 0 -e aes /dev/loop1 /mnt/dev_save$PUPSAVEFILE
- else
- echo "$MYPASS" | losetup -p 0 $CRYPTO /dev/loop1 /mnt/dev_save$PUPSAVEFILE
- fi
- }
- [ $pmedia ] && PMEDIA=$pmedia
- [ $pdev1 ] && PDEV1=$pdev1
- [ $psubdir ] && PSUBDIR=$psubdir
- [ $pkeys ] && PKEYS=$pkeys
- [ $psavemark ] && PSAVEMARK=$psavemark
- [ $PSUBDIR ] && [ "`echo -n "$PSUBDIR" | cut -c 1`" != "/" ] && PSUBDIR="/${PSUBDIR}"
- [ $pupsfs ] && PUPSFS=$pupsfs
- [ $zdrv ] && ZDRV=$zdrv
- [ $adrv ] && ADRV=$adrv
- [ $ydrv ] && YDRV=$ydrv
- [ $underdog ] && UNDERDOG=$underdog
- RDSH=""
- if [ "$pfix" ];then
- for ONEFIX in `echo -n "$pfix" | tr ',' ' '`
- do
- case $ONEFIX in
- ram) PRAMONLY="yes";;
- rdsh) RDSH="yes";;
- rdsh0) RDSH="0";;
- rdsh6) RDSH="6";;
- nox) PNOX="yes";;
- clean) PCLEAN="yes";;
- purge) PPURGE="yes";;
- copy) PCOPY="yes";;
- nocopy) PNOCOPY="yes";;
- fsck) PFSCK="yes";;
- [0-9]*) PIGNORELAST=$ONEFIX;;
- esac
- done
- fi
- PMEDIA="`echo -n "$PMEDIA" | sed -e 's%ide%ata%' -e 's%sata%ata%' -e 's%.*cd$%cd%'`"
- clear
- [ ! "$LOGLEVEL" ] && exec 1>/tmp/bootinit.log 2>&1
- export TZ='XXX-23'
- /bin/hwclock -s -l
- ZDRVINIT='no'
- [ `cat /lib/modules/$KERNELVER/modules.dep | wc -l` -gt 200 ] && ZDRVINIT='yes'
- FONTMAP=""
- [ -f /PUPPYKEYMAP ] && [ ! "$PKEYS" ] && PKEYS="`cat /PUPPYKEYMAP`"
- if [ "$PLANG" ];then
- if [ ! "$PKEYS" ];then
-
- PKEYS=${PLANG:0:2}
- case $PLANG in
- en*) PKEYS=us ;;
- esac
- fi
-
- case $PLANG in
- en*) echo ;;
- ar*|iw*)
- setfont /lib/consolefonts/LatArCyrHeb-16.psfu.gz -C /dev/tty1
- FONTMAP='LatArCyrHeb-16.psfu'
- ;;
- ru*)
- zcat /lib/consolefonts/ter-u16n.psf.gz | loadfont
- FONTMAP='ter-u16n.psf'
- ;;
- *)
- zcat /lib/consolefonts/LatGrkCyr-8x16.psfu.gz | loadfont
- FONTMAP='LatGrkCyr-8x16.psfu'
- ;;
- esac
- fi
- STATUS=0
- VFAT_OUT_PARAM='shortname=mixed,quiet,utf8'
- CODEPAGE=""
- KMAP=""
- if [ "$PKEYS" ];then
- if [ ! -f /lib/keymaps/${PKEYS}.gz ];then
- PKEYS="`ls -1 /lib/keymaps/${PKEYS}*.gz | head -n 1 | rev | cut -f 1 -d '/' | cut -f 2 -d '.' | rev`"
- fi
- if [ -f /lib/keymaps/${PKEYS}.gz ];then
- echo "Loading '${PKEYS}' keyboard layout..." >/dev/console
- KMAP="$PKEYS"
- zcat /lib/keymaps/${PKEYS}.gz | loadkmap ; STATUS=$(($STATUS + $?))
- case $PKEYS in
- de*|be*|br*|dk*|es*|fi*|fr*|it*|no*|se*|pt*)
- modprobe nls_cp850
- [ ! "$PLANG" ] && FONTMAP="lat1-12.psfu"
- CODEPAGE="850"
- VFAT_OUT_PARAM="$OUT_PARAM"',codepage=850'
- ;;
- cz*|hu*|pl*|ro*|sk*|croat*|slovene*)
- modprobe nls_cp852
- modprobe nls_iso8859-2
- [ ! "$PLANG" ] && FONTMAP="lat2-12.psfu"
- CODEPAGE="852"
- VFAT_OUT_PARAM="$OUT_PARAM"',codepage=852,iocharset=iso8859-2'
- ;;
- esac
- if [ ! "$PLANG" ];then
- if [ "$FONTMAP" ];then
- zcat /lib/consolefonts/${FONTMAP}.gz | loadfont
- STATUS=$(($STATUS + $?))
- fi
- fi
- else
- STATUS=1
- fi
- check_status $STATUS
- fi
- [ "$RDSH" = "0" ] && exec /bin/sh >/dev/console 2>&1
- echo -n "Loading drivers needed to access disk drives" > /dev/console
- [ "`modinfo floppy 2>/dev/null`" != "" ] && modprobe floppy > /dev/null 2>&1
- [ "`modinfo psmouse 2>/dev/null`" != "" ] && modprobe psmouse
- [ "`modinfo ppa 2>/dev/null`" != "" ] && modprobe ppa
- ELSPCI="`elspci -l`"
- if [ "`echo "$ELSPCI" | grep '060700'`" != "" ];then
- modprobe yenta_socket
-
-
- echo -n "." > /dev/console
- sleep 2
- fi
- [ "`echo "$ELSPCI" | grep '0C0320'`" != "" ] && modprobe ehci-hcd 2>/dev/null
- for ONEFSMOD in ext2 ext3 ext4 fat msdos vfat ntfs reiserfs udf f2fs
- do
- [ "`modinfo $ONEFSMOD 2>/dev/null`" != "" ] && modprobe $ONEFSMOD
- done
- echo -n "." > /dev/console
- MODALIASES="`cat /sys/bus/pci/devices/*/modalias`"
- for ONEMODALIAS in $MODALIASES
- do
- modprobe $ONEMODALIAS 2>/dev/null
-
- done
- [ "`lsmod | grep '^sdhci'`" != "" ] && modprobe mmc_core && modprobe mmc_block
- [ "`lsmod | grep '^tifm'`" != "" ] && modprobe mmc_core && modprobe mmc_block && modprobe tifm_sd
- modprobe squashfs
- modprobe sr_mod > /dev/null 2>&1
- modprobe nls_cp437 2>/dev/null
- modprobe nls_iso8859-1 2>/dev/null
- modprobe $LAYERFS
- modprobe fuse
- ALLDRVS0="`find /sys/block -maxdepth 1 -name 'mmc*' -o -name 'sd*' -o -name 'sr*' | xargs -l readlink 2>/dev/null | grep -v '/usb[0-9]' | rev | cut -f 1 -d '/' | rev`"
- ALLDRVS="`echo "$ALLDRVS0" | tr '\n' ' '`"
- [ "$ALLDRVS" = " " ] && ALLDRVS=""
- ATADRIVES="`echo "$ALLDRVS0" | grep -v '^sr' | tr '\n' ' '`"
- [ "$ATADRIVES" = " " ] && ATADRIVES=""
- ATAOPTICALDRIVES="`echo "$ALLDRVS0" | grep '^sr' | tr '\n' ' '`"
- [ "$ATAOPTICALDRIVES" = " " ] && ATAOPTICALDRIVES=""
- if [ -e /proc/ide ];then
- for ONEIDE in `ls -1 /proc/ide | grep '^hd' | tr '\n' ' '`
- do
- ALLDRVS="${ALLDRVS}${ONEIDE} "
- if [ "`cat /proc/ide/${ONEIDE}/media`" = "cdrom" ];then
- ATAOPTICALDRIVES="${ATAOPTICALDRIVES}${ONEIDE} "
- else
- ATADRIVES="${ATADRIVES}${ONEIDE} "
- fi
- done
- ALLDRVS0="`echo -n "$ALLDRVS" | tr ' ' '\n'`"
- fi
- ATADRIVES0="`echo -n "$ATADRIVES" | tr ' ' '\n'`"
- touch /tmp/ATADRIVES0
- [ "$ATADRIVES" != "" ] && echo "$ATADRIVES0" > /tmp/ATADRIVES0
- ATAOPTICALDRIVES0="`echo -n "$ATAOPTICALDRIVES" | tr ' ' '\n'`"
- touch /tmp/ALLDRVS0
- [ "$ALLDRVS" ] && echo "$ALLDRVS0" > /tmp/ALLDRVS0
- PCPARTSALL="`probepart_init -k`"
- PCPARTS0="`echo "$PCPARTSALL" | grep '^/dev/' | cut -f 1-2 -d '|' | grep -E 'f2fs|udf|iso9660|ext2|ext3|ext4|reiserfs|msdos|vfat|minix|ntfs' | sed -e 's%/dev/%%'`"
- LESSPARTS0="$PCPARTS0"
- OPTICALDRIVES0="`echo "$PCPARTS0" | grep -E 'iso9660|udf' | grep -v '^mmc' | cut -f 1 -d '|'`"
- touch /tmp/OPTICALDRIVES0
- [ "$OPTICALDRIVES0" != "" ] && echo "$OPTICALDRIVES0" > /tmp/OPTICALDRIVES0
- echo "ALLDRVS=$ALLDRVS " >> /tmp/puppy-file-search.log
- if [ "`lsmod | grep -E '^uhci|^ohci|^ehci'`" != "" ];then
- /sbin/wait4usb_classic &
- else
- /sbin/wait4usb &
- fi
- check_status 0
- echo -n "Searching for Puppy files..." > /dev/console
- PUPMODE=0
- touch /tmp/PUPSAVES
- KERNELNAME='vmlinuz'
- if [ "$PUPSFS" ];then
- DEV="`echo "$PUPSFS" | cut -f 1 -d ':'`"
- FS="`echo "$PCPARTS0" | grep "${DEV}|" | cut -f 2 -d '|'`"
- SPEC="`echo -n "$PUPSFS" | cut -f 2 -d ':'`"
- PUPXXXSFS="`basename $SPEC`"
- [ "$PSUBDIR" = "" ] && PSUBDIR="`dirname $SPEC`"
- [ "$PSUBDIR" = "/" ] && PSUBDIR=""
- PUPSFS="${DEV},${FS},${SPEC}"
- LESSPARTS0="${DEV}|${FS}"
- fi
- if [ "$ZDRV" ];then
- DEV="`echo "$ZDRV" | cut -f 1 -d ':'`"
- FS="`echo "$PCPARTS0" | grep "${DEV}|" | cut -f 2 -d '|'`"
- SPEC="`echo -n "$ZDRV" | cut -f 2 -d ':'`"
- ZDRVSFS="`basename $SPEC`"
- ZDRV="${DEV},${FS},${SPEC}"
- fi
- if [ "$ADRV" ];then
- DEV="`echo "$ADRV" | cut -f 1 -d ':'`"
- FS="`echo "$PCPARTS0" | grep "${DEV}|" | cut -f 2 -d '|'`"
- SPEC="`echo -n "$ADRV" | cut -f 2 -d ':'`"
- ADRVSFS="`basename $SPEC`"
- ADRV="${DEV},${FS},${SPEC}"
- fi
- if [ "$YDRV" ];then
- DEV="`echo "$YDRV" | cut -f 1 -d ':'`"
- FS="`echo "$PCPARTS0" | grep "${DEV}|" | cut -f 2 -d '|'`"
- SPEC="`echo -n "$YDRV" | cut -f 2 -d ':'`"
- YDRVSFS="`basename $SPEC`"
- YDRV="${DEV},${FS},${SPEC}"
- fi
- [ -f /${PUPXXXSFS} ] && PUPSFS="rootfs,rootfs,/${PUPXXXSFS}"
- [ -f /${ZDRVSFS} ] && ZDRV="rootfs,rootfs,/${ZDRVSFS}"
- [ -f /${ADRVSFS} ] && ADRV="rootfs,rootfs,/${ADRVSFS}"
- [ -f /${YDRVSFS} ] && YDRV="rootfs,rootfs,/${YDRVSFS}"
- search_func ata
- while [ ! -e /tmp/flag-usb-ready ];do
- usleep 250000
- done
- if [ -s /tmp/flag-usb-ready ];then
- ALLDRVS="`ls -1 /sys/block | grep -E '^scd|^sd|^mmc|^sr' | tr '\n' ' '`"
- [ "$ALLDRVS" = " " ] && ALLDRVS=""
- [ -e /proc/ide ] && ALLDRVS="${ALLDRVS}`ls -1 /proc/ide | grep '^hd' | tr '\n' ' '`"
- ALLDRVS0="`echo -n "$ALLDRVS" | tr -s ' ' | tr ' ' '\n'`"
- echo "$ALLDRVS0" > /tmp/ALLDRVS0
-
- PCPARTSALL="`probepart_init -k`"
- PCPARTS0="`echo "$PCPARTSALL" | grep '^/dev/' | cut -f 1-2 -d '|' | grep -E 'f2fs|udf|iso9660|ext2|ext3|ext4|reiserfs|msdos|vfat|minix|ntfs' | sed -e 's%/dev/%%'`"
- LESSPARTS0="$PCPARTS0"
-
- OPTICALDRIVES0="`echo "$PCPARTS0" | grep -E 'iso9660|udf' | grep -v -E '^sd|^mmc' | cut -f 1 -d '|'`"
- touch /tmp/OPTICALDRIVES0
- [ "$OPTICALDRIVES0" ] && echo "$OPTICALDRIVES0" > /tmp/OPTICALDRIVES0
- echo "ALLDRVS=$ALLDRVS " >> /tmp/puppy-file-search.log
- PUPSFS_OPT=""
- if [ "$PUPSFS" ]; then
- FS=$(echo $PUPSFS | cut -s -f2 -d',')
- echo $FS | grep -q -E 'iso9660|udf' && PUPSFS_OPT=$PUPSFS && PUPSFS=""
- fi
- if [ "$VMLINUZ" = "" -o "$PUPSFS" = "" -o "$SAVEPART" = "" ];then
- search_func usb
- fi
- [ "$PUPSFS" ] || PUPSFS=$PUPSFS_OPT
- fi
- cp -f /tmp/PUPSAVES /tmp/PUPSAVES-complete
- [ "$PUPSFS" = "" ] && DROPOUT="${PUPXXXSFS}"
- if [ "$DROPOUT" ];then
- echo -en "\\033[1;31m" >/dev/console
- echo -n "${DROPOUT} not found. Dropping out to initial-ramdisk console..." >/dev/console
- /bin/echo -e "\\033[0;39m" >/dev/console
- exec /bin/sh >/dev/console 2>&1
- fi
- if [ "$VMLINUZ" = "" ];then
-
-
- [ "$DEV1FS" = "" -a "$PDEV1" != "" ] && DEV1FS="`echo "$LESSPARTS0" | grep "${PDEV1}|" | cut -f 2 -d '|'`"
- BOOTDRV="`echo -n "$PDEV1" | grep -o -f /tmp/ALLDRVS0`"
- VMLINUZ='vmlinuz'
- fi
- PUPMODE=`expr $PUPMODE + 4`
- if [ ! "$PUPSAVE" ];then
- if [ "$PRAMONLY" != "yes" ];then
- if [ "$IGNORE" = "optical" ];then
-
- grep "${PSUBDIR}/" /tmp/PUPSAVES > /tmp/PUPSAVES2
- if [ "$SAVEPART" ];then
- grep "${SAVEPART} " /tmp/PUPSAVES2 > /tmp/PUPSAVES
- else
- grep "${PDEV1} " /tmp/PUPSAVES2 > /tmp/PUPSAVES
- fi
- fi
-
- if [ -s /tmp/PUPSAVES ];then
- touch /tmp/PUPSAVE2SFSS
- cat /tmp/PUPSAVES |
- while read ONELINE
- do
- ONEDEV="`echo -n "$ONELINE" | cut -f 1 -d ' '`"
- ONEFS="`echo -n "$ONELINE" | cut -f 2 -d ' '`"
- ONEPUPSAVES="`echo -n "$ONELINE" | cut -f 3-99 -d ' '`"
- for ONEPUPSAVE in $ONEPUPSAVES
- do
- echo "${ONEDEV},${ONEFS},${ONEPUPSAVE}" >> /tmp/PUPSAVE2SFSS
- done
- done
- NUMPUPSAVES=`cat /tmp/PUPSAVE2SFSS | wc -l`
- if [ $NUMPUPSAVES -eq 1 ];then
- PUPSAVE="`cat /tmp/PUPSAVE2SFSS`"
- else
- CNTSAVE=1
- echo -e "\\033[1;36m" >/dev/console
- echo "Type a number to choose which personal file to use:" > /dev/console
- echo "0 none" > /dev/console
- for ONECHOICE in `cat /tmp/PUPSAVE2SFSS | tr '\n' ' '`
- do
- ONEFILE="`echo -n "$ONECHOICE" | cut -f 3 -d ','`"
- ONEPART="`echo -n "$ONECHOICE" | cut -f 1 -d ','`"
- echo -e "${CNTSAVE} ${ONEPART}\\033[10G${ONEFILE}" > /dev/console
- CNTSAVE=`expr $CNTSAVE + 1`
- done
- echo -en "\\033[0;39m" >/dev/console
- read NUMSAVE
- [ $NUMSAVE -ne 0 ] && PUPSAVE="`cat /tmp/PUPSAVE2SFSS | tr '\n' ' ' | cut -f $NUMSAVE -d ' '`"
- fi
- fi
-
- fi
- [ "$PUPSAVE" ] && PUPMODE=`expr $PUPMODE + 8`
- fi
- [ ! "$PUPSAVE" ] && [ "$DEV1PUP" = "yes" -o "$DEV2PUP" != "" ] && PUPMODE=`expr $PUPMODE + 2`
- case $PUPMODE in
- 4)
- PUPMODE=5
- ;;
- 6)
-
- DRVSAVE="`echo -n "$PDEV1" | sed -e 's/[0-9]*$//' -e 's/p$//'`"
- REMOVABLEDRVSAVE="`cat /sys/block/$DRVSAVE/removable`"
- [ "$REMOVABLEDRVSAVE" = "1" -a "$PMEDIA" != "usbhd" ] && PUPMODE=7
-
-
- [ "$PMEDIA" = "usbflash" ] && PUPMODE=7
- ;;
- 12)
- DRVSAVE="`echo -n "$PUPSAVE" | cut -f 1 -d ',' | sed -e 's/[0-9]*$//' -e 's/p$//'`"
- REMOVABLEDRVSAVE="`cat /sys/block/$DRVSAVE/removable`"
- [ "$REMOVABLEDRVSAVE" = "1" -a "$PMEDIA" != "usbhd" ] && PUPMODE=13
- [ "$PMEDIA" = "usbflash" ] && PUPMODE=13
- [ "$PMEDIA" = "ataflash" ] && PUPMODE=13
- ;;
- 76)
- PUPMODE=77
- ;;
- esac
- check_status 0
- RAMSIZE=`free | grep -o 'Mem: .*' | tr -s ' ' | cut -f 2 -d ' '`
- CRYPTO=""
- STATUS=0
- CREATETMPFS="";CREATEPDEV1="";CREATEPUPXXXSFS="";CREATEPUPSAVE2FS="";CREATEFOLDERS=""
- case $PUPMODE in
- 3) CREATETMPFS="/pup_rw";CREATEPDEV1="/pup_ro1"
- OLDFILESMNTPT="/pup_ro1";NEWFILESMNTPT="/pup_ro1";UMNTRW="/pup_rw=rw:";UMNTRO0="/pup_ro1=ro+wh:";;
- 5) CREATETMPFS="/pup_rw";CREATEPUPXXXSFS="/pup_ro2"
- OLDFILESMNTPT="";NEWFILESMNTPT="/pup_ro2";UMNTRW="/pup_rw=rw:";UMNTRO1="/pup_ro2=ro";;
- 6) CREATEPDEV1="/pup_rw";CREATEPUPXXXSFS="/pup_ro2"
- OLDFILESMNTPT="/pup_rw";NEWFILESMNTPT="/pup_ro2";UMNTRW="/pup_rw=rw:";UMNTRO1="/pup_ro2=ro";;
- 7) CREATETMPFS="/pup_rw";CREATEPDEV1="/pup_ro1";CREATEPUPXXXSFS="/pup_ro2"
- OLDFILESMNTPT="/pup_ro1";NEWFILESMNTPT="/pup_ro2";UMNTRW="/pup_rw=rw:";UMNTRO0="/pup_ro1=ro+wh:";UMNTRO1="/pup_ro2=ro";;
- 12) CREATEPUPSAVE2FS="/pup_rw";CREATEPUPXXXSFS="/pup_ro2"
- OLDFILESMNTPT="/pup_rw";NEWFILESMNTPT="/pup_ro2";UMNTRW="/pup_rw=rw:";UMNTRO1="/pup_ro2=ro";;
- 13) CREATETMPFS="/pup_rw";CREATEPUPSAVE2FS="/pup_ro1";CREATEPUPXXXSFS="/pup_ro2"
- OLDFILESMNTPT="/pup_ro1";NEWFILESMNTPT="/pup_ro2";UMNTRW="/pup_rw=rw:";UMNTRO0="/pup_ro1=ro+wh:";UMNTRO1="/pup_ro2=ro";;
- 77) CREATETMPFS="/pup_rw";CREATEFOLDERS="/pup_ro1";CREATEPUPXXXSFS="/pup_ro2"
- OLDFILESMNTPT="/pup_ro1";NEWFILESMNTPT="/pup_ro2";UMNTRW="/pup_rw=rw:";UMNTRO0="/pup_ro1=ro+wh:";UMNTRO1="/pup_ro2=ro";;
- *) RDSH="yes";;
- esac
- if [ "$CREATEPDEV1" != "" ];then
- if [ "$DEV2PUP" ];then
- DEV="`echo -n "$DEV2PUP" | cut -f 1 -d '|'`"
- FS="`echo -n "$DEV2PUP" | cut -f 2 -d '|'`"
- else
- DEV="$PDEV1"
- FS="$DEV1FS"
- fi
- [ "`echo "$FS" | grep 'ext[234]'`" != "" ] && echo "/dev/$DEV $CREATEPDEV1 $FS defaults 1 1" >> /etc/fstab
- if [ "$PFSCK" = "yes" -a "$pdev1" = "" ]; then
- FSCKME="$DEV $FS"
- fsckme_func $FSCKME
- fi
- mount -t $FS /dev/$DEV $CREATEPDEV1
- check_status $?
-
- if [ "$CREATEPDEV1" = "/pup_rw" -o "$CREATEPDEV1" = "/pup_ro1" ];then
- SMNTPT="$CREATEPDEV1"
- PUPSAVE="$DEV,$FS,/"
- fi
- fi
- if [ "$CREATEPUPSAVE2FS" != "" ];then
- PUPSAVEDEV="`echo -n "$PUPSAVE" | cut -f 1 -d ','`"
- PUPSAVEFS="`echo -n "$PUPSAVE" | cut -f 2 -d ','`"
- PUPSAVEFILE="`echo -n "$PUPSAVE" | cut -f 3 -d ','`"
-
- echo -n "Loading personal file $PUPSAVEFILE ($PUPSAVEDEV)..." > /dev/console
- [ "`echo "$PUPSAVEFS" | grep 'ext[234]'`" != "" ] && echo "/dev/$PUPSAVEDEV /mnt/dev_save $PUPSAVEFS defaults 1 1" >> /etc/fstab
- mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV /mnt/dev_save noatime
- if [ $? -eq 0 ];then
- SMNTPT="/mnt/dev_save"
-
- if [ ! "`echo "$PUPSAVEFILE" | grep '_crypt'`" = "" ];then
- case $PUPSAVEFILE in
- *cryptx*)
- CRYPTO='-E 1'
- modprobe cryptoloop
- ;;
- *)
- CRYPTO='-e aes'
- modprobe cryptoloop
- modprobe aes_generic 2>/dev/null
- modprobe aes 2>/dev/null
- modprobe crypto_blkcipher 2>/dev/null
- modprobe blkcipher 2>/dev/null
- modprobe cbc
- ;;
- esac
- fi
- if [ -d /mnt/dev_save${PUPSAVEFILE} ]; then
-
- if [ "$PFSCK" = "yes" -a "$pdev1" = "" ]; then
- umount /mnt/dev_save
- MOUNTED=$(cat /proc/mounts | grep $PUPSAVEDEV |cut -f 2 -d ' ')
- MNTOPT=$(cat /proc/mounts | grep $PUPSAVEDEV |cut -f 4 -d ' ')
- umount $MOUNTED
- FSCKME="$(echo $PUPSAVE | tr ',' ' ')"
- fsckme_func $FSCKME
- mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV $MOUNTED $MNTOPT
- mntfunc $PUPSAVEFS /dev/$PUPSAVEDEV /mnt/dev_save noatime
- fi
- rm -r -f "$CREATEPUPSAVE2FS"
- ln -s /mnt/dev_save${PUPSAVEFILE} $CREATEPUPSAVE2FS
- elif [ "$CRYPTO" != "" ] ; then
- echo "" >/dev/console
- echo "Mounting encrypted $PUPSAVEFILE..." > /dev/console
- while true; do
-
-
- if [ -f /mnt/dev_save/pupsaveresizenew.txt ];then
- . /mnt/dev_save/pupsaveresizenew.txt
- if echo ${PUPSAVEFILEX}|grep -q ${PUPSAVEFILE##*/} ;then
- if [ ! -e /bin/e2fsck ];then
- echo -e -n "\\033[1;31m SORRY, cannot resize ${PUPSAVEFILE} \\033[0;39m" > /dev/console
- rm -f /mnt/dev_save/pupsaveresizenew.txt
- else
- resize_pupsave_func
- fi
- mnt_enc_pupsave_func
- fsck_pupsave_func /dev/loop1
- else
- mnt_enc_pupsave_func
- fi
- else
- mnt_enc_pupsave_func
- fi
- echo "/dev/loop1 $CREATEPUPSAVE2FS ext2 defaults 1 1" >> /etc/fstab
- [ "$PFSCK" = "yes" ] && fsckme_func loop1 ext2
- mount -t ext2 -o noatime,rw /dev/loop1 $CREATEPUPSAVE2FS
- MNTSTAT=$?
- if [ "$MNTSTAT" = "0" ] ; then
- echo -n "...successfully mounted" >/dev/console
- break
- else
- [ ! -e /bin/e2fsck ] && break
- echo -en "\\033[1;31m" >/dev/console
- echo "Can't mount file, press ENTER key to try again." >/dev/console
- echo "Or, any other char then ENTER for f.s. check then try again." > /dev/console
- echo -n "Or, for developers type 'quit' to drop out to console: " > /dev/console
- echo -en "\\033[0;39m" >/dev/console
- read crypttryagain
- echo > /dev/console
- [ "$crypttryagain" = "quit" ] && exec /bin/sh >/dev/console 2>&1
- [ "$crypttryagain" != "" ] && e2fsck -y -f /dev/loop1 >/dev/console
- losetup -d /dev/loop1
- fi
- done
- else
-
- if [ -f /mnt/dev_save/pupsaveresizenew.txt ];then
- . /mnt/dev_save/pupsaveresizenew.txt
- if echo ${PUPSAVEFILEX}|grep -q ${PUPSAVEFILE##*/} ;then
- if [ ! -e /bin/e2fsck ];then
- echo -e -n "\\033[1;31m SORRY, cannot resize ${PUPSAVEFILE} \\033[0;39m" > /dev/console
- rm -f /mnt/dev_save/pupsaveresizenew.txt
- else
- resize_pupsave_func
- fsck_pupsave_func /mnt/dev_save$PUPSAVEFILE
- fi
- fi
- fi
-
- losetup /dev/loop1 /mnt/dev_save${PUPSAVEFILE}
- SFFS='ext'`echo -n "$PUPSAVEFILE" | rev | cut -c 3`
- echo "/dev/loop1 $CREATEPUPSAVE2FS $SFFS defaults 1 1" >> /etc/fstab
- [ "$PFSCK" = "yes" ] && fsckme_func loop1 $SFFS
- mount -t $SFFS -o noatime /dev/loop1 $CREATEPUPSAVE2FS
- if [ $? -ne 0 ];then
- if [ -e /bin/e2fsck ];then
- e2fsck -y -f /dev/loop1 > /dev/console
- mount -t $SFFS -o noatime /dev/loop1 $CREATEPUPSAVE2FS
- fi
- fi
- fi
- fi
- STATUS=$?
- check_status $STATUS
-
- if [ $STATUS -eq 0 ];then
- if [ $PUPMODE -eq 12 -o $PUPMODE -eq 13 ];then
- OLDDISTRO_VERSION="`grep '^DISTRO_VERSION' $CREATEPUPSAVE2FS/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d "'" | cut -f 2 -d '"' | cut -f 1 -d ' '`"
- PUPPY_FOLDER="`grep '^PUPSAVE' $CREATEPUPSAVE2FS/etc/rc.d/PUPSTATE | cut -f 3 -d ','`"
- if vercmp ${DISTRO_VERSION} gt ${OLDDISTRO_VERSION} ;then
- if [ "$NUMPUPSAVES" != "0" ];then
- echo -e "\\033[1;36m" >/dev/console
- echo "This save-file was last used with version $OLDDISTRO_VERSION of Puppy." >/dev/console
- echo "Hit the ENTER key only if it is okay to upgrade this file, or to not use it and boot up in RAM only type any other printable character." >/dev/console
- echo -n "ENTER only to upgrade: " >/dev/console
- echo -en "\\033[0;39m" >/dev/console
- read noupgradesf
- if [ "$noupgradesf" != "" ];then
- echo -en "\\033[1;35m" >/dev/console
- echo "Backing off, not using save-file, booting in RAM only, PUPMODE=5..." >/dev/console
- echo -en "\\033[0;39m" >/dev/console
- sync
- if [ -L "$CREATEPUPSAVE2FS" ]; then
- rm -f "$CREATEPUPSAVE2FS"
- mkdir $CREATEPUPSAVE2FS
- else
- umount $CREATEPUPSAVE2FS
- fi
- PUPMODE=5
- CREATETMPFS="";CREATEPDEV1="";CREATEPUPXXXSFS="";CREATEPUPSAVE2FS="";CREATEFOLDERS=""
- CREATETMPFS="/pup_rw";CREATEPUPXXXSFS="/pup_ro2"
- OLDFILESMNTPT="";NEWFILESMNTPT="/pup_ro2";UMNTRW="/pup_rw=rw:";UMNTRO1="/pup_ro2=ro"
- fi
- fi
-
- if [ "`echo -n "$BOOTDRV" | grep -f /tmp/OPTICALDRIVES0`" != "" ];then
- if [ "$CREATEPUPSAVE2FS" ];then
- xPUPSFSDEV="`echo -n "$PUPSFS" | cut -f 1 -d ','`"
- xPUPSFSFS="`echo -n "$PUPSFS" | cut -f 2 -d ','`"
- xPUPSFSFILE="`echo -n "$PUPSFS" | cut -f 3 -d ','`"
- basepupsfs="`basename $xPUPSFSFILE`"
- [ "`echo $PUPPY_FOLDER | cut -f 3 -d '/'`" = "" ] && dirpupsfs="/" || dirpupsfs="`dirname $PUPPY_FOLDER`"
-
- touch /tmp/version_update_flag
- if [ "`echo -n "$xPUPSFSDEV" | grep -f /tmp/OPTICALDRIVES0`" != "" ];then
-
- echo -e "\\033[1;36m" >/dev/console
- echo "The main Puppy file '${basepupsfs}' is being loaded off an optical" >/dev/console
- echo "disc. Very slow!" >/dev/console
- echo "If you are updating an older version in your hard disk, type the" >/dev/console
- echo "ENTER key only to update all the files in your installation." >/dev/console
- echo "Or type \"s\" to copy only the SFS(s) at the root of the partition" >/dev/console
- echo "of your save-file. Then on next boot from the CD puppy will load" >/dev/console
- echo "the puppy SFSs from there." >/dev/console
- echo "Type any other printable character not to copy anything." >/dev/console
- echo -n "ENTER key only to update: " >/dev/console
- echo -en "\\033[0;39m" >/dev/console
- read nocopysfs
- if [ "$nocopysfs" = "" -o "$nocopysfs" = "s" ];then
- echo -en "\\033[1;35m" >/dev/console
- echo "'${basepupsfs}' now copying to hard drive (but only available next boot)..." >/dev/console
- echo -en "\\033[0;39m" >/dev/console
- PPATTERN="/dev/$xPUPSFSDEV "
- PUPSFSDEVMNTPT="`mount | grep -m1 "$PPATTERN" | cut -f 3 -d ' '`"
- if [ "$PUPSFSDEVMNTPT" = "" ];then
- mntfunc $xPUPSFSFS /dev/$xPUPSFSDEV /mnt/dev_ro2
- PUPSFSDEVMNTPT="/mnt/dev_ro2"
- UMOUNTME="/mnt/dev_ro2"
- fi
-
- if [ "$nocopysfs" = "s" ];then
- cp -f ${PUPSFSDEVMNTPT}/*.sfs /mnt/dev_save
- else
- if [ -f /mnt/dev_save/"$dirpupsfs"/initrd.gz ]; then
- cp -f ${PUPSFSDEVMNTPT}/*.sfs /mnt/dev_save/"$dirpupsfs"
- mv /mnt/dev_save/"$dirpupsfs"/initrd.gz /mnt/dev_save/"$dirpupsfs"/initrd.gz.OLD
- mv /mnt/dev_save/"$dirpupsfs"/vmlinuz /mnt/dev_save/"$dirpupsfs"/vmlinuz.OLD
- cp -f ${PUPSFSDEVMNTPT}/initrd.gz /mnt/dev_save/"$dirpupsfs"
- cp -f ${PUPSFSDEVMNTPT}/vmlinuz /mnt/dev_save/"$dirpupsfs"
- else
- cp -f ${PUPSFSDEVMNTPT}/*.sfs /mnt/dev_save
- fi
- fi
- sync
- fi
- fi
- fi
- fi
-
- fi
- fi
- fi
- fi
- EXTRAALLOCK=0
- SWAPPART="`echo "$PCPARTSALL" | grep '|swap|' | head -n 1`"
- [ "$SWAPPART" ] && SWAPPARTSIZE=`echo -n "$SWAPPART" | cut -f 3 -d '|'`
- [ $SWAPPARTSIZE ] && EXTRAALLOCK=`expr $SWAPPARTSIZE \/ 2`
- if [ $EXTRAALLOCK -eq 0 ];then
- [ -f ${SMNTPT}/pupswap.swp ] && SWAPFILESIZEBYTES=`stat -c %s ${SMNTPT}/pupswap.swp`
- [ $SWAPFILESIZEBYTES ] && EXTRAALLOCK=`expr $SWAPFILESIZEBYTES \/ 2048`
- fi
- FREEK=0
- if [ "$CREATETMPFS" != "" ];then
- FREEK=`expr $RAMSIZE \/ 2`
- [ $PUPMODE -eq 77 ] && FREEK=`expr $FREEK - 50000`
- ALLOCK=`expr $FREEK + $EXTRAALLOCK`
- mount -t tmpfs -o size=${ALLOCK}k tmpfs $CREATETMPFS
- fi
- [ $FREEK -eq 0 ] && FREEK=`df | grep ' /pup_rw' | tr -s ' ' | cut -f 4 -d ' '`
- [ ! $FREEK ] && FREEK=0
- if [ "$CREATEFOLDERS" != "" ];then
- PUPSAVEDEV="`echo -n "$PUPSAVE" | cut -f 1 -d ','`"
- PUPSAVEFS="`echo -n "$PUPSAVE" | cut -f 2 -d ','`"
- PUPSAVEFILE="`echo -n "$PUPSAVE" | cut -f 3 -d ','`"
- mount -o noatime -t $PUPSAVEFS /dev/$PUPSAVEDEV /mnt/dev_ro1
-
- ALLOCK=`expr $RAMSIZE \/ 2 - 50000`
- mount -t tmpfs -o size=${ALLOCK}k tmpfs $CREATEFOLDERS
-
-
- CDMNTPT="/mnt/dev_ro1"
- DESTDIR="$CREATEFOLDERS"
- BKFOLDERS="`ls -1 -r $CDMNTPT | grep '^20[0-9][0-9]'`"
- BKLASTFOLDER="`echo "$BKFOLDERS" | head -n 1`"
-
- if [ "$PIGNORELAST" ];then
- BKBADLIST="`echo "$BKFOLDERS" | head -n ${PIGNORELAST}`"
- if [ -f $CDMNTPT/$BKLASTFOLDER/.badfolders ];then
- cp $CDMNTPT/$BKLASTFOLDER/.badfolders $DESTDIR/
- if [ ! $? -eq 0 ];then
-
- BKPREVFOLDER="`echo "$BKFOLDERS" | head -n 2 | tail -n 1`"
- [ -f $CDMNTPT/$BKPREVFOLDER/.badfolders ] && cp $CDMNTPT/$BKPREVFOLDER/.badfolders $DESTDIR/
- fi
- fi
- echo "$BKBADLIST" >> $DESTDIR/.badfolders
-
- sync
- else
- [ -f $CDMNTPT/$BKLASTFOLDER/.badfolders ] && cp $CDMNTPT/$BKLASTFOLDER/.badfolders $DESTDIR/
- fi
- [ -f $DESTDIR/.badfolders ] && BKBADLIST="`cat $DESTDIR/.badfolders | tr "\n" " "`"
- BKFOLDERS="`echo -n "$BKFOLDERS" | tr "\n" " "`"
- for ONEFOLDER in $BKFOLDERS
- do
- if [ ! "`echo -n "$BKBADLIST" | grep "$ONEFOLDER"`" = "" ];then
- echo "Folder $ONEFOLDER marked bad." >/dev/console
- continue
- fi
- echo -n "Loading folder $ONEFOLDER from CD/DVD..." >/dev/console
-
- FREERAMDISK=`df 2>/dev/null | grep "$DESTDIR" | head -n 1 | tr -s " " | cut -f 4 -d " "`
- SIZEFOLDER=`du -k -s ${CDMNTPT}/${ONEFOLDER} | cut -f 1`
- if [ -d ${CDMNTPT}/${ONEFOLDER}/archive ];then
- SIZEARCHIVE=`du -k -s ${CDMNTPT}/${ONEFOLDER}/archive | cut -f 1`
- else
- SIZEARCHIVE=0
- fi
- SIZESOURCE=`expr $SIZEFOLDER - $SIZEARCHIVE`
- if [ $FREERAMDISK -gt $SIZESOURCE ];then
-
-
- [ -d $CDMNTPT/$ONEFOLDER/bin ] && cp -a -u $CDMNTPT/$ONEFOLDER/bin $DESTDIR/ > /dev/null 2>&1
- [ -d $CDMNTPT/$ONEFOLDER/sbin ] && cp -a -u $CDMNTPT/$ONEFOLDER/sbin $DESTDIR/ > /dev/null 2>&1
- [ -d $CDMNTPT/$ONEFOLDER/etc ] && cp -a -u $CDMNTPT/$ONEFOLDER/etc $DESTDIR/ > /dev/null 2>&1
- [ -d $CDMNTPT/$ONEFOLDER/lib ] && cp -a -u $CDMNTPT/$ONEFOLDER/lib $DESTDIR/ > /dev/null 2>&1
- [ -d $CDMNTPT/$ONEFOLDER/opt ] && cp -a -u $CDMNTPT/$ONEFOLDER/opt $DESTDIR/ > /dev/null 2>&1
- if [ -d $CDMNTPT/$ONEFOLDER/root/.var_saved ];then
- mkdir -p $DESTDIR/var
- cp -a -u $CDMNTPT/$ONEFOLDER/root/.var_saved/* $DESTDIR/var/ > /dev/null 2>&1
- fi
- [ -d $CDMNTPT/$ONEFOLDER/root ] && cp -a -u $CDMNTPT/$ONEFOLDER/root $DESTDIR/ > /dev/null 2>&1
- [ -d $CDMNTPT/$ONEFOLDER/root/.var_saved ] && rm -rf $DESTDIR/root/.var_saved > /dev/null 2>&1
- [ -d $CDMNTPT/$ONEFOLDER/usr ] && cp -a -u $CDMNTPT/$ONEFOLDER/usr $DESTDIR/ > /dev/null 2>&1
- [ $DEVTMPFSFLG -eq 0 ] && [ -d $CDMNTPT/$ONEFOLDER/dev ] && cp -a -u $CDMNTPT/$ONEFOLDER/dev $DESTDIR/ > /dev/null 2>&1
- cp -a -u $CDMNTPT/$ONEFOLDER/*.sfs $DESTDIR/ > /dev/null 2>&1
-
- WHITEOUTS="`find $DESTDIR -xdev -type f -name .wh.* | grep -v '__dir_opaque' | grep -v '.wh..wh.'`"
- echo "$WHITEOUTS" |
- while read DELWHITE
- do
- DELFILE="`echo -n "$DELWHITE" | sed -e 's/\\.wh\\.//g'`"
- if [ -e "$DELFILE" ];then
- rm -rf "$DELFILE"
- rm -rf "$DELWHITE"
- fi
- done
- check_status 0
- else
- echo -n -e "\\033[70G\\033[1;31m" >/dev/console
- echo -n "RAM full" >/dev/console
- echo -e "\\033[0;39m" >/dev/console
- break
- fi
- done
- sync
-
- umount /mnt/dev_ro1
- fi
- OLDDISTRO_VERSION="$DISTRO_VERSION"
- [ -f $OLDFILESMNTPT/etc/puppyversion ] && OLDDISTRO_VERSION="`cat $OLDFILESMNTPT/etc/puppyversion`"
- [ -f $OLDFILESMNTPT/etc/DISTRO_SPECS ] && OLDDISTRO_VERSION="`grep '^DISTRO_VERSION' $OLDFILESMNTPT/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d "'" | cut -f 2 -d '"' | cut -f 1 -d ' '`"
- REASON=''
- vercmp $DISTRO_VERSION gt $OLDDISTRO_VERSION && REASON='upgrade'
- [ $PUPMODE -eq 5 ] && REASON='firstboot'
- if [ "$REASON" != "" ];then
- mkdir /tmp/scsi-keep
- for ONEKEEP in imm.ko ppa.ko raid_class.ko sg.ko scsi_wait_scan.ko
- do
- ONEFND="`find /lib/modules/$KERNELVER/kernel/drivers/scsi -type f -name $ONEKEEP`"
- [ "$ONEFND" ] && cp -a $ONEFND /tmp/scsi-keep/
- done
- rm -rf /lib/modules/$KERNELVER/kernel/drivers/scsi
- cp -a /tmp/scsi-keep /lib/modules/$KERNELVER/kernel/drivers/scsi
- fi
- if [ "$REASON" = "upgrade" ];then
- if [ -d /pup_rw/lib/modules/initrd ];then
- rm -rf /pup_rw/lib/modules/initrd
- rm -f /pup_rw/lib/modules/modules.*
- fi
- if [ -d /pup_ro1/lib/modules/initrd ];then
- rm -rf /pup_ro1/lib/modules/initrd
- rm -f /pup_ro1/lib/modules/modules.*
- fi
- fi
- if [ "$ZDRVINIT" = "yes" ];then
-
- ZDRV=''
-
- [ ! -d /pup_rw/lib/modules/all-firmware ] && [ ! -d /pup_ro1/lib/modules/all-firmware ] && [ $FREEK -gt 24000 ] && REASON='restore'
- if [ "$REASON" != "" ];then
- [ -d /pup_rw/lib/modules ] && rm -rf /pup_rw/lib/modules
- [ -d /pup_ro1/lib/modules ] && rm -rf /pup_ro1/lib/modules
- mkdir -p /pup_rw/lib
- mv /lib/modules /pup_rw/lib/
- mkdir -p /pup_rw/initrd
- cp -af /DISTRO_SPECS /pup_rw/initrd/
- cp -af /init /pup_rw/initrd/
- sync
- fi
- else
-
-
- [ ! -d /pup_rw/lib/modules/$KERNELVER/initrd ] && [ ! -d /pup_ro1/lib/modules/$KERNELVER/initrd ] && REASON="new"
- if [ "$REASON" = "new" ];then
- mkdir -p /pup_rw/lib/modules/$KERNELVER
- mv /lib/modules/$KERNELVER /pup_rw/lib/modules/$KERNELVER/initrd
- rm -f /pup_rw/lib/modules/$KERNELVER/initrd/modules.*
- sync
-
- fi
- fi
- COPY2RAM=""
- COPYMSG='copying to ram'
- if [ "$CREATEPUPXXXSFS" != "" ];then
-
- PUPSFSDEV="`echo -n "$PUPSFS" | cut -f 1 -d ','`"
- PUPSFSFS="`echo -n "$PUPSFS" | cut -f 2 -d ','`"
- PUPSFSFILE="`echo -n "$PUPSFS" | cut -f 3 -d ','`"
- basepupsfs="`basename $PUPSFSFILE`"
-
- echo -n "Loading the '${basepupsfs}' main file..." > /dev/console
- if [ "$PUPSFSDEV" = "rootfs" ];then
- PUPSFSDEVMNTPT=""
- COPY2RAM='yes'
- else
- PPATTERN="/dev/$PUPSFSDEV "
- PUPSFSDEVMNTPT="`mount | grep -m1 "$PPATTERN" | cut -f 3 -d ' '`"
- if [ "$PUPSFSDEVMNTPT" = "" ];then
- mntfunc $PUPSFSFS /dev/$PUPSFSDEV /mnt/dev_ro2
- PUPSFSDEVMNTPT="/mnt/dev_ro2"
- UMOUNTME="/mnt/dev_ro2"
- fi
- fi
-
-
- SIZESFSK=`du -k ${PUPSFSDEVMNTPT}${PUPSFSFILE} | cut -f 1`
- SIZESFSK=$(($SIZESFSK + 1000))
- MINRAM2CPY=$(($SIZESFSK * 2))
-
-
- pdPATTERN="`echo "$PUPSFSDEV" | sed -e 's/[0-9]*$//'` "
- if [ "$PNOCOPY" != "yes" ];then
- [ "`echo -n "$ATADRIVES" | grep "$pdPATTERN"`" = "" ] && COPYCONTENDER='yes'
- [ $PUPMODE -eq 5 ] && COPYCONTENDER='yes'
- [ "$DEV1FS" = "iso9660" ] && COPYCONTENDER='yes'
- [ "$DEV1FS" = "udf" ] && COPYCONTENDER='yes'
- [ $RAMSIZE -gt 700000 ] && COPYCONTENDER='yes'
- fi
- [ "$PCOPY" = "yes" ] && COPYCONTENDER='yes'
-
- [ "$COPYCONTENDER" = "yes" ] && [ $RAMSIZE -gt 400000 ] && [ $RAMSIZE -gt $MINRAM2CPY ] && COPY2RAM="yes"
-
- if [ "$COPY2RAM" = "yes" ];then
- mount -t tmpfs -o size=${SIZESFSK}k tmpfs /mnt/tmpfs
- if [ "${PUPSFSDEVMNTPT}" = "" ];then
- mv -f ${PUPSFSDEVMNTPT}${PUPSFSFILE} /mnt/tmpfs/
- else
- echo -e -n " \\033[1;35m${COPYMSG}\\033[0;39m" > /dev/console
- cp -af ${PUPSFSDEVMNTPT}${PUPSFSFILE} /mnt/tmpfs/
- fi
- sync
- SFSBASENAME="`basename $PUPSFSFILE`"
- losetup /dev/loop0 /mnt/tmpfs/${SFSBASENAME}
- else
- losetup /dev/loop0 ${PUPSFSDEVMNTPT}${PUPSFSFILE}
- fi
- mount -r -t squashfs -o noatime /dev/loop0 $CREATEPUPXXXSFS
- fi
- ZLAYER=''
- ZFACTOR=''
- if [ "$ZDRVINIT" != "yes" ];then
-
- if [ "$ZDRV" != "" ];then
- ZDEV="`echo "$ZDRV" | cut -f 1 -d ','`"
- ZFS="`echo "$ZDRV" | cut -f 2 -d ','`"
- ZFILE="`echo "$ZDRV" | cut -f 3 -d ','`"
- MNT_ZFILE=""
- if [ "$ZDEV" = "rootfs" ];then
- MNT_ZFILE=""
- COPY2RAM='yes'
- else
- zPATTERN="/dev/$ZDEV "
- MNT_ZFILE="`mount | grep -m1 "$zPATTERN" | cut -f 3 -d ' '`"
- fi
- ZBASENAME="`basename $ZFILE`"
- if [ "$MNT_ZFILE" != "" ];then
- if [ "$COPY2RAM" = "yes" ];then
- SIZEZK=`du -k ${MNT_ZFILE}${ZFILE} | cut -f 1`
- SIZEZK=`expr $SIZEZK + 1000`
- mount -t tmpfs -o size=${SIZEZK}k tmpfs /mnt/tmpfs4
- if [ "$MNT_ZFILE" = "" ];then
- mv -af ${MNT_ZFILE}${ZFILE} /mnt/tmpfs4/
- else
- cp -af ${MNT_ZFILE}${ZFILE} /mnt/tmpfs4/
- fi
- sync
- losetup /dev/loop4 /mnt/tmpfs4/${ZBASENAME}
- else
- losetup /dev/loop4 ${MNT_ZFILE}${ZFILE}
- fi
- mount -r -t squashfs -o noatime /dev/loop4 /pup_z
- if [ $? -eq 0 ];then
- ZLAYER=':/pup_z=ro'
- ZFACTOR="$ZBASENAME"
- fi
- fi
- fi
- fi
- if [ $PUPMODE -eq 5 ];then
- if [ -s /tmp/RWPART ];then
- pdFLG=0
- pdDEV="$(cat /tmp/RWPART | cut -f 1 -d '|')"
- pdFS="$(cat /tmp/RWPART | cut -f 2 -d '|')"
- pdMNTPT="$(cat /proc/mounts | grep "/dev/${pdDEV} " | cut -f 2 -d ' ')"
- if [ ! "$pdMNTPT" ];then
- mkdir -p /mnt/$pdDEV
- mntfunc $pdFS /dev/$pdDEV /mnt/$pdDEV
- pdFLG=1
- pdMNTPT="/mnt/${pdDEV}"
- fi
- if [ ! -f ${pdMNTPT}/pupdesk.flg ];then
- touch ${pdMNTPT}/pupdesk.flg
- else
-
- mkdir -p /pup_rw/var/local
- cp -f ${pdMNTPT}/pupdesk.flg /pup_rw/var/local/quicksetup-pupmode5-autodriver
- mkdir -p /pup_rw/root
- touch /pup_rw/root/.xorgwizard-reenter
-
- fi
- [ $pdFLG -eq 1 ] && umntfunc $pdMNTPT
- fi
- else
- [ -f /tmp/RWPART ] && rm -f /tmp/RWPART
- fi
- ALAYER=''
- AFACTOR=''
- if [ "$ADRV" != "" ];then
- ADEV="`echo "$ADRV" | cut -f 1 -d ','`"
- AFS="`echo "$ADRV" | cut -f 2 -d ','`"
- AFILE="`echo "$ADRV" | cut -f 3 -d ','`"
- MNT_AFILE=""
- aPATTERN="/dev/$ADEV "
- MNT_AFILE="`mount | grep -m1 "$aPATTERN" | cut -f 3 -d ' '`"
- ABASENAME="`basename $AFILE`"
- if [ "$MNT_AFILE" != "" ];then
- if [ "$COPY2RAM" = "yes" ];then
- SIZEZK=`du -k ${MNT_AFILE}${AFILE} | cut -f 1`
- SIZEZK=`expr $SIZEZK + 1000`
- mount -t tmpfs -o size=${SIZEZK}k tmpfs /mnt/tmpfs2
- cp -af ${MNT_AFILE}${AFILE} /mnt/tmpfs2/
- sync
- losetup /dev/loop2 /mnt/tmpfs2/${ABASENAME}
- else
- losetup /dev/loop2 ${MNT_AFILE}${AFILE}
- fi
- mount -r -t squashfs -o noatime /dev/loop2 /pup_a > /dev/console 2>&1
- if [ $? -eq 0 ];then
- ALAYER='/pup_a=ro:'
- AFACTOR="$ABASENAME"
- fi
- fi
- fi
- YLAYER=''
- YFACTOR=''
- if [ "$YDRV" != "" ];then
- YDEV="`echo "$YDRV" | cut -f 1 -d ','`"
- YFS="`echo "$YDRV" | cut -f 2 -d ','`"
- YFILE="`echo "$YDRV" | cut -f 3 -d ','`"
- MNT_YFILE=""
- yPATTERN="/dev/$YDEV "
- MNT_YFILE="`mount | grep -m1 "$yPATTERN" | cut -f 3 -d ' '`"
- YBASENAME="`basename $YFILE`"
- if [ "$MNT_YFILE" != "" ];then
- if [ "$COPY2RAM" = "yes" ];then
- SIZEZK=`du -k ${MNT_YFILE}${YFILE} | cut -f 1`
- SIZEZK=`expr $SIZEZK + 1000`
- mount -t tmpfs -o size=${SIZEZK}k tmpfs /mnt/tmpfs3
- cp -af ${MNT_YFILE}${YFILE} /mnt/tmpfs3/
- sync
- losetup /dev/loop3 /mnt/tmpfs3/${YBASENAME}
- else
- losetup /dev/loop3 ${MNT_YFILE}${YFILE}
- fi
- mount -r -t squashfs -o noatime /dev/loop3 /pup_y > /dev/console 2>&1
- if [ $? -eq 0 ];then
- YLAYER='/pup_y=ro:'
- YFACTOR="$YBASENAME"
- fi
- fi
- fi
- [ "$UMOUNTME" != "" ] && umntfunc $UMOUNTME
- check_status 0
- zPSUBDIR=''
- [ "$PUPSFS" ] && zPSUBDIR="`echo -n "$PUPSFS" | cut -f 3 -d ',' | sed -e 's%/[^/]*$%%'`"
- [ "$zPSUBDIR" = "" -o "$zPSUBDIR" = "/" ] && zPSUBDIR="$PSUBDIR"
- mkdir -p /pup_rw/etc/rc.d
- echo "PUPMODE=$PUPMODE" > /pup_rw/etc/rc.d/PUPSTATE
- echo "PDEV1='$PDEV1'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo "DEV1FS='$DEV1FS'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo "PUPSFS='$PUPSFS'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo "PUPSAVE='$PUPSAVE'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo "PMEDIA='$PMEDIA'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo '#ATADRIVES is all internal ide/pata/sata drives, excluding optical, excluding usb...' >> /pup_rw/etc/rc.d/PUPSTATE
- echo "ATADRIVES='$ATADRIVES'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo '#ATAOPTICALDRIVES is list of non-usb optical drives...' >> /pup_rw/etc/rc.d/PUPSTATE
- echo "ATAOPTICALDRIVES='$ATAOPTICALDRIVES'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo '#these directories are unionfs/aufs layers in /initrd...' >> /pup_rw/etc/rc.d/PUPSTATE
- echo "SAVE_LAYER='$OLDFILESMNTPT'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo "PUP_LAYER='$NEWFILESMNTPT'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo "#The partition that has the ${DISTRO_FILE_PREFIX}save file is mounted here..." >> /pup_rw/etc/rc.d/PUPSTATE
- echo "PUP_HOME='${SMNTPT}'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo '#(in /initrd) ...note, /mnt/home is a link to it.' >> /pup_rw/etc/rc.d/PUPSTATE
- echo '#this file has extra kernel drivers and firmware...' >> /pup_rw/etc/rc.d/PUPSTATE
- echo "ZDRV='$ZDRV'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo "ADRV='$ADRV'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo "YDRV='$YDRV'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo '#complete set of modules in the initrd (moved to main f.s.)...' >> /pup_rw/etc/rc.d/PUPSTATE
- echo "ZDRVINIT='$ZDRVINIT'" >> /pup_rw/etc/rc.d/PUPSTATE
- echo '#Partition no. override on boot drive to which session is (or will be) saved...' >> /pup_rw/etc/rc.d/PUPSTATE
- echo "PSAVEMARK='$PSAVEMARK'" >> /pup_rw/etc/rc.d/PUPSTATE
- if [ "$PLANG" ];then
- echo "#PLANG is written to LANG in /etc/profile by init script initrd...
- PLANG=${PLANG}
- OUTPUT_CHARSET=UTF-8
- export OUTPUT_CHARSET" >> /pup_rw/etc/rc.d/PUPSTATE
- fi
- echo "PSUBDIR='${zPSUBDIR}'" >> /pup_rw/etc/rc.d/PUPSTATE
- [ ! -f $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG ] && touch $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG
- . $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG
- [ ! -f $OLDFILESMNTPT/var/local/etc_profile_at_shutdown ] && cp -f $OLDFILESMNTPT/etc/profile $OLDFILESMNTPT/var/local/etc_profile_at_shutdown
- echo -n "Setting up the layered filesystem..." > /dev/console
- NEWUNIONRECORD=""
- CNTLOOP=5 ; UMNTRO=""
- if [ "$PUPSAVE" != "" ];then
- if [ "$SMNTPT" != "" -o $PUPMODE -eq 77 ];then
- touch /tmp/EXTRASFSS
- SFSSDIR="$SMNTPT"
-
- xSFSSDIRx=""
- xPSUBDIR="`echo -n "$PUPSAVE" | cut -f 3 -d ',' | sed -e 's%/[^/]*$%%'`"
- [ "$xPSUBDIR" ] && xSFSSDIRx="${SMNTPT}${xPSUBDIR}"'/*.sfs'
- [ $PUPMODE -eq 77 ] && SFSSDIR="$DESTDIR"
-
- touch /tmp/LOGONEBASES
-
- if [ "$EXTRASFSLIST" != "" ];then
-
-
- for ONEEXTRA in $EXTRASFSLIST ; do
- ONEBASE="`basename $ONEEXTRA`"
- echo "$ONEBASE" | grep -qE '^z|^pup[_-]' && continue
- echo "/tmp/EXTRASFSS" | grep -q "$ONEBASE" && continue
- [ "$xPSUBDIR" != "" ] && [ -s "$SFSSDIR$xPSUBDIR/$ONEBASE" ] && echo "$SFSSDIR$xPSUBDIR/$ONEBASE" >> /tmp/EXTRASFSS && continue
- [ -s "$SFSSDIR/$ONEBASE" ] && echo "$SFSSDIR/$ONEBASE" >> /tmp/EXTRASFSS && continue
- done
- fi
- UMNTRO="" ; EXTRASFSLIST=""
- if [ -s /tmp/EXTRASFSS ];then
- for ONEEXTRA in `cat /tmp/EXTRASFSS | tr '\n' ' '`
- do
- ONEBASE="`basename $ONEEXTRA`"
- EXTRASFSLIST="${EXTRASFSLIST}${ONEBASE} "
- losetup /dev/loop${CNTLOOP} $ONEEXTRA
- mount -r -t squashfs -o noatime /dev/loop${CNTLOOP} /pup_ro${CNTLOOP}
- [ $? -eq 0 ] && UMNTRO="${UMNTRO}:/pup_ro${CNTLOOP}=ro"
- CNTLOOP=`expr $CNTLOOP + 1`
- [ $CNTLOOP -eq 10 ] && break
-
-
-
- done
- fi
-
- SAVEFILE="`echo -n "$PUPSAVE" | cut -f 3 -d ','`"
- SAVEFILENAMEONLY="`basename $SAVEFILE`"
- SFSFILE="`echo -n "$PUPSFS" | cut -f 3 -d ','`"
- SFSFILENAMEONLY="`basename $SFSFILE`"
- RECORDLIST="$SAVEFILENAMEONLY $AFACTOR $YFACTOR $SFSFILENAMEONLY $ZFACTOR $EXTRASFSLIST"
- NEWUNIONRECORD="`echo "$RECORDLIST" | tr -s ' ' | sed -e 's/ $//'`"
-
- [ ! "$UNDERDOG" ] && [ "$xPSUBDIR" ] && [ -f "${SMNTPT}${xPSUBDIR}/underdog.lnx" ] && UNDERDOG="`cat "${SMNTPT}${xPSUBDIR}/underdog.lnx"`"
- [ ! "$UNDERDOG" ] && [ -f $SFSSDIR/underdog.lnx ] && UNDERDOG="`cat ${SFSSDIR}/underdog.lnx`"
-
- fi
- fi
- if [ "$UNDERDOG" ];then
- udPTN1="${UNDERDOG}|"
- FNDPART="`echo "$PCPARTS0" | grep "$udPTN1"`"
- if [ "$FNDPART" ];then
- udPTN2="/dev/${UNDERDOG} "
- UDMNTPT="`mount | grep -m1 "$udPTN2" | cut -f 3 -d ' '`"
- if [ ! "$UDMNTPT" ];then
- udFS="`echo -n "$FNDPART" | cut -f 2 -d '|'`"
- mount -r -t $udFS /dev/$UNDERDOG /pup_ro${CNTLOOP}
- if [ $? -eq 0 ];then
- UMNTRO="${UMNTRO}:/pup_ro${CNTLOOP}=ro"
-
- MNTFIX='/pup_rw'
- [ "`echo -n "$UMNTRO" | grep 'pup_ro1'`" != "" ] && MNTFIX='/pup_ro1'
- [ ! -f $MNTFIX/lib/.wh.i686 ] && touch /pup_rw/lib/.wh.i686
-
- REALQTDIR="`find /pup_ro${CNTLOOP}/usr/lib -maxdepth 1 -type d -name 'qt*' | tail -n 1 | sed -e "s/\/pup_ro${CNTLOOP}\/usr\/lib\///"`"
- if [ "$REALQTDIR" ];then
- if [ ! -e $MNTFIX/usr/lib/qt ];then
- [ "`find /pup_ro${CNTLOOP}/usr/lib -maxdepth 1 -xtype d -name qt`" = "" ] && ln -s $REALQTDIR /pup_rw/usr/lib/qt
- fi
- fi
- CNTLOOP=`expr $CNTLOOP + 1`
- fi
- fi
- fi
- fi
- xBOOTCONFIG="`grep -v '^PREVUNIONRECORD' $OLDFILESMNTPT/etc/rc.d/BOOTCONFIG | sed -e 's/^LASTUNIONRECORD/PREVUNIONRECORD/'`"
- echo "$xBOOTCONFIG" > /pup_rw/etc/rc.d/BOOTCONFIG
- echo "LASTUNIONRECORD='$NEWUNIONRECORD'" >> /pup_rw/etc/rc.d/BOOTCONFIG
- [ "$LASTUNIONRECORD" = "$NEWUNIONRECORD" ] && NEWUNIONRECORD=""
- if [ "$OLDFILESMNTPT" != "" ];then
-
- rm -rf $OLDFILESMNTPT/tmp/*
- rm -rf $OLDFILESMNTPT/tmp/.[0-9a-zA-Z]*
- if [ ! -L $OLDFILESMNTPT/usr/X11R6 ];then
-
- if [ -d $OLDFILESMNTPT/usr/X11R6 ];then
- mkdir -p $OLDFILESMNTPT/usr/X11R7
- cp -af $OLDFILESMNTPT/usr/X11R6/* $OLDFILESMNTPT/usr/X11R7/
- rm -rf $OLDFILESMNTPT/usr/X11R6
- fi
- [ -d X11R7 ] && ln -s X11R7 $OLDFILESMNTPT/usr/X11R6
- fi
- rm -rf $OLDFILESMNTPT/root/tmp 2>/dev/null
- rm -f $OLDFILESMNTPT/root/.wh.tmp 2>/dev/null
- NEWPVERSION="$DISTRO_VERSION"
- if [ -f $OLDFILESMNTPT/etc/puppyversion ];then
- OLDPVERSION="`cat $OLDFILESMNTPT/etc/puppyversion`"
- rm -f $OLDFILESMNTPT/etc/puppyversion
- fi
- [ -f $OLDFILESMNTPT/etc/DISTRO_SPECS ] && OLDPVERSION="`grep '^DISTRO_VERSION' $OLDFILESMNTPT/etc/DISTRO_SPECS | cut -f 2 -d '=' | cut -f 2 -d '"' | cut -f 2 -d "'" | cut -f 1 -d ' '`"
- [ "$OLDPVERSION" = "" ] && OLDPVERSION="$NEWPVERSION"
- if vercmp ${NEWPVERSION} gt ${OLDPVERSION} ; then
-
- rm -f $OLDFILESMNTPT/etc/rc.d/functions
- rm -f $OLDFILESMNTPT/etc/rc.d/functions4puppy4
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.country
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.network_basic
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.services
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.shutdown
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.sysinit
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.update
-
- touch /tmp/version_update_flag
- fi
-
- [ "$PCLEAN" = "yes" ] && xOLDPVERSION='0.0'
- [ "$PPURGE" = "yes" ] && xOLDPVERSION='0.0'
- if vercmp ${NEWPVERSION} gt ${xOLDPVERSION} ; then
- echo -e "\\033[1;35m" >/dev/console
- echo "Version cleanup, restoring 'official' files, please wait..." >/dev/console
- echo -en "\\033[0;39m" >/dev/console
- echo "(with a slow CPU this may take sometime, please be patient)" >/dev/console
-
- [ -f $OLDFILESMNTPT/root/Choices/ROX-Filer/PuppyPin ] && touch $OLDFILESMNTPT/root/Choices/ROX-Filer/PuppyPin
- [ -f $OLDFILESMNTPT/root/Choices/ROX-Filer/globicons ] && touch $OLDFILESMNTPT/root/Choices/ROX-Filer/globicons
- mkdir $OLDFILESMNTPT/tmp/versioncleanup
-
- rm -f $OLDFILESMNTPT/etc/rc.d/functions
- rm -f $OLDFILESMNTPT/etc/rc.d/functions4puppy4
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.country
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.network_basic
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.services
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.shutdown
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.sysinit
- rm -f $OLDFILESMNTPT/etc/rc.d/rc.update
-
- touch /tmp/version_update_flag
-
-
-
- cd $NEWFILESMNTPT
-
-
- DOTCNT=0
- find ./ -noleaf -type f | sed -e 's/^\.//g' |
- while read ONENEW
- do
- DOTCNT=`expr $DOTCNT + 1`
- [ $DOTCNT -gt 100 ] && DOTCNT=0
- [ $DOTCNT -eq 100 ] && echo -n '*' >/dev/console
-
- [ ! "`echo -n "$ONENEW" | grep -E '^/dev|^/tmp|^/proc| '`" = "" ] && continue
- ONEBASE="`basename $OLDFILESMNTPT$ONENEW`"
- OLDDIR="`dirname $OLDFILESMNTPT$ONENEW`"
-
- [ -f $OLDDIR/.wh.$ONEBASE ] && rm -f $OLDDIR/.wh.$ONEBASE
- [ -f $OLDDIR/.wh.__dir_opaque ] && rm -f $OLDDIR/.wh.__dir_opaque
- [ -f $OLDDIR/.wh..wh..opq ] && rm -f $OLDDIR/.wh..wh..opq
-
- while [ ! "$OLDDIR" = "/" ];do
- OLDDIR="`dirname $OLDDIR`"
- UP1BASE="`basename $OLDDIR`"
- [ -f $OLDDIR/.wh.$UP1BASE ] && rm -f $OLDDIR/.wh.$UP1BASE
- [ -f $OLDDIR/.wh.__dir_opaque ] && rm -f $OLDDIR/.wh.__dir_opaque
- [ -f $OLDDIR/.wh..wh..opq ] && rm -f $OLDDIR/.wh..wh..opq
- done
-
- if [ -f $OLDFILESMNTPT$ONENEW ];then
-
-
- MODIFOLD=`$PUPFILESDIR/bin/stat -c %Y $OLDFILESMNTPT$ONENEW`
- MODIFNEW=`$PUPFILESDIR/bin/stat -c %Y $NEWFILESMNTPT$ONENEW`
- [ "$PPURGE" = "yes" ] && MODIFNEW=`expr $MODIFOLD + 1`
- if [ $MODIFNEW -ge $MODIFOLD ];then
- echo -n " $ONENEW " >/dev/console
- ONEDIR="`dirname $ONENEW`"
- mkdir -p $OLDFILESMNTPT/tmp/versioncleanup$ONEDIR
- cp -af $OLDFILESMNTPT$ONENEW $OLDFILESMNTPT/tmp/versioncleanup$ONEDIR/
- rm -f $OLDFILESMNTPT$ONENEW
- fi
- fi
- done
- echo >/dev/console
- cd /
- fi
-
- if [ "$NEWUNIONRECORD" != "" -o "$PPURGE" = "yes" ];then
-
- cd $OLDFILESMNTPT
- find ./ -noleaf -type f -name ".wh.*" | sed -e 's/^\.//g' |
- while read ONEOPAQUE
- do
- ONEDIR="`dirname $ONEOPAQUE`"
- WHBASE="`basename $ONEOPAQUE`"
- if [ "$WHBASE" != ".wh.__dir_opaque" -a "$WHBASE" != ".wh..wh..opq" ];then
-
- ONEDEL="`echo -n "$WHBASE" | sed -e 's/^\\.wh\\.//g'`"
- ONEDIR="${ONEDIR}/${ONEDEL}"
- [ ! -e ".${ONEDIR}" ] && continue
- fi
-
- [ -d /pup_ro3${ONEDIR} ] && rm -f ${OLDFILESMNTPT}${ONEOPAQUE}
- [ -d /pup_ro4${ONEDIR} ] && rm -f ${OLDFILESMNTPT}${ONEOPAQUE}
- [ -d /pup_ro5${ONEDIR} ] && rm -f ${OLDFILESMNTPT}${ONEOPAQUE}
- [ -d /pup_ro6${ONEDIR} ] && rm -f ${OLDFILESMNTPT}${ONEOPAQUE}
- [ -d /pup_ro7${ONEDIR} ] && rm -f ${OLDFILESMNTPT}${ONEOPAQUE}
- [ -d /pup_ro8${ONEDIR} ] && rm -f ${OLDFILESMNTPT}${ONEOPAQUE}
- [ -d /pup_ro9${ONEDIR} ] && rm -f ${OLDFILESMNTPT}${ONEOPAQUE}
- done
- cd /
- fi
- if vercmp $NEWPVERSION gt $xOLDPVERSION ; then
- vPATTERN="s%^DISTRO_VERSION=.*%DISTRO_VERSION='${xOLDPVERSION}'%"
- sed -e "$vPATTERN" $OLDFILESMNTPT/etc/DISTRO_SPECS > /tmp/distro_specs_old
- cp -f /tmp/distro_specs_old $OLDFILESMNTPT/etc/DISTRO_SPECS
- sync
- OLDstr='to'
- [ "$xOLDPVERSION" != "0.0" ] && OLDstr="from version $xOLDPVERSION to"
- echo -e "\\033[1;35m" >/dev/console
- [ "$PCLEAN" = "yes" ] && echo "This is a simulated version upgrade, which performs a file cleanup." >/dev/console
- [ "$PPURGE" = "yes" ] && echo "This is a radical file cleanup for broken systems, could alter some settings." >/dev/console
- echo "You are upgrading Puppy ${OLDstr} ${NEWPVERSION}." >/dev/console
- echo "Overwritten old files have been moved to /tmp/versioncleanup/" >/dev/console
- echo "After bootup please examine this directory (before shutdown) for anything that you might like to recover. Pausing 30 secs so you can read this msg..." >/dev/console
- echo -en "\\033[0;39m" >/dev/console
- sleep 30
- fi
- fi
- [ "$RDSH" = "6" ] && exec /bin/sh >/dev/console 2>&1
- if [ "$LAYERFS" = "aufs" ];then
- mount -t aufs -o udba=reval,diropq=w,dirs=${UMNTRW}${UMNTRO0}${ALAYER}${YLAYER}${UMNTRO1}${ZLAYER}${UMNTRO} unionfs /pup_new
- else
- UMNTRW="`echo -n "$UMNTRW" | sed -e 's/+wh//g'`"
- mount -t unionfs -o dirs=${UMNTRW}${UMNTRO0}${ALAYER}${YLAYER}${UMNTRO1}${ZLAYER}${UMNTRO} unionfs /pup_new
- fi
- check_status $?
- if [ -d $PUPSFSDEVMNTPT/precfg ];then
- echo -n "Overlaying preconfig files..." > /dev/console
- SRC="$PUPSFSDEVMNTPT"/precfg
- DEST="/pup_new"
- cd $SRC
- for i in `find . -not -type d -print`; do
- BASEFILE="$i"
- SRCFILE="$SRC/$BASEFILE"
- DESTFILE="$DEST/$BASEFILE"
- DESTDIR=`dirname $DESTFILE`
- MASK="777"
- if test -f "$DESTFILE"; then
- MASK=`stat -c %a $DESTFILE`
- fi
- mkdir -p $DESTDIR
- cp -f $SRCFILE $DESTFILE
- chmod $MASK $DESTFILE
- done
- check_status 0
- fi
- echo -n "Performing a 'switch_root' to the layered filesystem..." > /dev/console
- mkdir -p /pup_new/initrd
- mkdir -p /pup_new/initrd/pup_ro1
- mkdir -p /pup_new/initrd/pup_ro2
- mkdir -p /pup_new/initrd/pup_ro3
- mkdir -p /pup_new/initrd/pup_ro4
- mkdir -p /pup_new/initrd/pup_ro5
- mkdir -p /pup_new/initrd/pup_ro6
- mkdir -p /pup_new/initrd/pup_ro7
- mkdir -p /pup_new/initrd/pup_ro8
- mkdir -p /pup_new/initrd/pup_ro9
- mkdir -p /pup_new/initrd/pup_rw
- mkdir -p /pup_new/initrd/pup_z
- mkdir -p /pup_new/initrd/pup_a
- mkdir -p /pup_new/initrd/pup_y
- mkdir -p /pup_new/initrd/mnt
- mkdir -p /pup_new/initrd/mnt/data
- mkdir -p /pup_new/initrd/mnt/dev_ro1
- mkdir -p /pup_new/initrd/mnt/dev_ro2
- mkdir -p /pup_new/initrd/mnt/dev_save
- mkdir -p /pup_new/initrd/mnt/swap
- mkdir -p /pup_new/initrd/mnt/tmpfs
- mkdir -p /pup_new/initrd/mnt/tmpfs2
- mkdir -p /pup_new/initrd/mnt/tmpfs3
- mkdir -p /pup_new/initrd/mnt/tmpfs4
- mkdir -p /pup_new/initrd/mnt/zdrv
- mkdir -p /pup_new/initrd/mnt/adrv
- mkdir -p /pup_new/initrd/mnt/ydrv
- mkdir -p /pup_new/initrd/tmp
- for ONEMNT in `mount | cut -f 3 -d ' ' | grep -v 'pup_new' | grep '^/pup_' | tr '\n' ' '`
- do
- mount -o move $ONEMNT /pup_new/initrd${ONEMNT}
- done
- for ONEMNT in `mount | cut -f 3 -d ' ' | grep '^/mnt/' | tr '\n' ' '`
- do
- mount -o move $ONEMNT /pup_new/initrd${ONEMNT}
- done
- if [ "${PUPSAVEFILE}" -a -d /pup_new/initrd/mnt/dev_save${PUPSAVEFILE} ]; then
- if [ "${CREATEPUPSAVE2FS}" -a -L "${CREATEPUPSAVE2FS}" ]; then
- rm -r -f "/pup_new/initrd${CREATEPUPSAVE2FS}"
- ln -s /initrd/mnt/dev_save${PUPSAVEFILE} /pup_new/initrd${CREATEPUPSAVE2FS}
- fi
- fi
- if [ "$CREATETMPFS" != "/pup_rw" ];then
- ALLOCK=`expr $RAMSIZE \/ 4 + $EXTRAALLOCK`
-
- [ ! -e /pup_new/tmp/versioncleanup ] && mount -t tmpfs -o size=${ALLOCK}k tmpfs /pup_new/tmp
- fi
- [ "$PNOX" = "yes" ] && touch /pup_new/tmp/bootcnt.txt
- cp -a /DISTRO_SPECS /pup_new/initrd/
- cp -af /tmp/* /pup_new/initrd/tmp/
- mkdir -p /pup_new/lib/keymaps
- cp -a -f /lib/keymaps/* /pup_new/lib/keymaps/
- mkdir -p /pup_new/lib/consolefonts
- cp -a -f /lib/consolefonts/* /pup_new/lib/consolefonts/
- if [ "$KMAP" ];then
- echo -n "$KMAP" > /pup_new/etc/keymap
- echo -n "$FONTMAP" > /pup_new/etc/fontmap
- echo -n "$CODEPAGE" > /pup_new/etc/codepage
- fi
- if [ -f /bin/TARGETEXES ];then
- for ONEEXE in `cat /bin/TARGETEXES`
- do
- BASEEXE="`basename $ONEEXE`"
- [ ! -e /pup_new/$ONEEXE ] && cp -f /bin/$BASEEXE /pup_new/$ONEEXE
- done
- cp -f /bin/TARGETEXES /pup_new/bin/
- fi
- if [ $DEVTMPFSFLG -eq 0 ];then
- cp -a -u -f /dev/* /pup_new/dev/
- else
- mount -t devtmpfs devtmpfs /pup_new/dev
- fi
- if [ "$PLANG" ];then
- langPTN="s%^LANG=.*%LANG=${PLANG}%"
- sed -i -e "$langPTN" /pup_new/etc/profile
- fi
- if [ "$RDSH" = "yes" ];then
- echo > /dev/console
- echo "Dropped to initramfs shell. Type 'exec switch' to continue booting Puppy." > /dev/console
- exec /bin/sh >/dev/console 2>&1
- fi
- case $PMEDIA in
- *cd)
- [ "$PDEV1" ] && umount /dev/$PDEV1 2>/dev/null
- ;;
- esac
- sync
- umount /proc/bus/usb
- umount /sys
- umount /proc
- exec switch_root /pup_new /sbin/init
|