Page 1 of 1

Uprading Ulimate Edition 3.4.2 to 3.4.3

PostPosted: Thu Jan 23, 2014 12:00 am
by TheeMahn
I have began upgrading Ultimate Edition 3.4.2 to Ultimate Edition 3.4.3 a Long Term Supported (LTS) Release, why?
3.4.2.png
~1/2 a gig of updates since it's release... Over 1/2 a gig in x64 non lite.

In order to make this a simplified task, I have taken it upon myself to write a script to somewhat automate this process.

What the script I am going to provide does is process the ISO's in your current folder, no matter how many of them there are. This script is being released in hopes that it may help someone. The script requires the use of superuser and should be considered dangerous. I take 0 responsibilty if it hoses your O/S. I call the script Super Upgrade ;)

What does the script do?
  • Creates a folder based on {FOLDERNAME}.ISO
  • Moves the ISO to {FOLDERNAME}
  • Changes to {FOLDERNAME}
  • Creates 4 folders {mnt, edit, squashfs, extract-cd}
  • Mounts {FOLDERNAME}.ISO at mnt/
  • Rsyncs the contents to extract-cd/
  • Mounts the squashfs at squashfs/
  • Copys the contents to edit/
  • Unmounts both the Squashfs and ISO
  • Cleans up by removing the ISO, mnt/ & squashfs/ (Since we are going to build a new O/S)
  • Repeats the entire process above until there are no more ISO's to process.
OUTPUT:
Super Upgrade 1.7.5, 01/22/2014
GNU Super Upgrade home page: <http://ultimateedition.info/>.
E-mail bug reports to: <[email protected]>.
Be sure to include the word Super Upgrade somewhere in the Subject: field.
Processing 1 of 4 detected Operating systems, please wait.
Operating System Version detected: 3.4.2
Creating folder ultimate-edition-3.4.2-x64
Moving ultimate-edition-3.4.2-x64.iso to ultimate-edition-3.4.2-x64
Operating System Version detected: 3.4.2
Creating folder ultimate-edition-3.4.2-x64-lite
Moving ultimate-edition-3.4.2-x64-lite.iso to ultimate-edition-3.4.2-x64-lite
Operating System Version detected: 3.4.2
Creating folder ultimate-edition-3.4.2-x86
Moving ultimate-edition-3.4.2-x86.iso to ultimate-edition-3.4.2-x86
Operating System Version detected: 3.4.2
Creating folder ultimate-edition-3.4.2-x86-lite
Moving ultimate-edition-3.4.2-x86-lite.iso to ultimate-edition-3.4.2-x86-lite
Scanning folders...
Processing Folder: ultimate-edition-3.4.2-x64/
Mounting ultimate-edition-3.4.2-x64.iso
Syncronising ultimate-edition-3.4.2-x64.iso
Mounting SquashFs
mount: only root can do that
Copying SquashFs
cp: cannot stat `squashfs/*': No such file or directory
Unmounting SquashFS
umount: /home/theemahn/Videos/ultimate-edition-3.4.2-x64/squashfs is not mounted (according to mtab)
Unmounting ultimate-edition-3.4.2-x64.iso
umount: /home/theemahn/Videos/ultimate-edition-3.4.2-x64/mnt is not mounted (according to mtab)
Cleaning up...
ERROR: Syncronisation error, not deleting ultimate-edition-3.4.2-x64.iso.

This is why it requires su, at least it was smart enough not to scrap the ISO let's adjust to root:
Password:
root@JackHammer:/home/theemahn/Videos# ./super-upgrade
Super Upgrade 1.7.5, 01/22/2014
GNU Super Upgrade home page: <http://ultimateedition.info/>.
E-mail bug reports to: <[email protected]>.
Be sure to include the word Super Upgrade somewhere in the Subject: field.
ls: cannot access *.iso: No such file or directory
No ISO's to processing in current folder.
Scanning folders...
Processing Folder: ultimate-edition-3.4.2-x64/
Mounting ultimate-edition-3.4.2-x64.iso
Syncronising ultimate-edition-3.4.2-x64.iso
Mounting SquashFs
Copying SquashFs
Unmounting SquashFS
Unmounting ultimate-edition-3.4.2-x64.iso
Cleaning up...
Processing Folder: ultimate-edition-3.4.2-x64-lite/
Mounting ultimate-edition-3.4.2-x64-lite.iso
Syncronising ultimate-edition-3.4.2-x64-lite.iso
Mounting SquashFs
Copying SquashFs
Unmounting SquashFS
Unmounting ultimate-edition-3.4.2-x64-lite.iso
Cleaning up...
Processing Folder: ultimate-edition-3.4.2-x86/
Mounting ultimate-edition-3.4.2-x86.iso
Syncronising ultimate-edition-3.4.2-x86.iso
Mounting SquashFs
Copying SquashFs
Unmounting SquashFS
Unmounting ultimate-edition-3.4.2-x86.iso
Cleaning up...
Processing Folder: ultimate-edition-3.4.2-x86-lite/
Mounting ultimate-edition-3.4.2-x86-lite.iso
Syncronising ultimate-edition-3.4.2-x86-lite.iso
Mounting SquashFs
Copying SquashFs
Unmounting SquashFS
Unmounting ultimate-edition-3.4.2-x86-lite.iso
Cleaning up...
root@JackHammer:/home/theemahn/Videos#



The Code:
Code: Select all
#!/bin/bash
# Version Control
PROGNAME="Super Upgrade"
VERSION="1.7.5"
BUILDDATE="01/22/2014"

# set colors so errors etc. stand out.

txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
unkblk='\e[4;30m' # Black - Underline
undred='\e[4;31m' # Red
undgrn='\e[4;32m' # Green
undylw='\e[4;33m' # Yellow
undblu='\e[4;34m' # Blue
undpur='\e[4;35m' # Purple
undcyn='\e[4;36m' # Cyan
undwht='\e[4;37m' # White
bakblk='\e[40m'   # Black - Background
bakred='\e[41m'   # Red
badgrn='\e[42m'   # Green
bakylw='\e[43m'   # Yellow
bakblu='\e[44m'   # Blue
bakpur='\e[45m'   # Purple
bakcyn='\e[46m'   # Cyan
bakwht='\e[47m'   # White
txtrst='\e[0m'    # Text Reset

# Get Directory executed in.
CURRENT=$PWD
BUMPVERSION=$1

function VersionDump {
echo -e "${undwht}$PROGNAME $VERSION, $BUILDDATE${txtrst}
GNU $PROGNAME home page: <http://ultimateedition.info/>.
E-mail bug reports to: <[email protected]>.
Be sure to include the word $PROGNAME somewhere in the Subject: field."
}

# Dump program header
VersionDump
# Scan for ISO's. Supress errors if they do not exist.
ISOS=$((ls *.iso) 2>/dev/null)
# Process ISO's only if they exist.
if [[ $ISOS ]]; then
   NISOS=$(ls *.iso | wc -l)
   array_counter=$(($array_counter + 1))
   echo -e "${bldgrn}Processing $array_counter of $NISOS detected Operating systems, please wait.${txtrst}"
   for i in `ls *.iso`
   do
      EXTENSION="${i##*.}"
      FILENAME="${i%.*}"
      CVERSION=$(echo $FILENAME | cut -d "-" -f3)
      echo "Operating System Version detected:" $CVERSION
      if [[ -d $FILENAME ]]; then
         echo -e "${txtylw}Folder already exists.${txtrst}"
      else
         echo -e "${txtgrn}Creating folder $FILENAME${txtrst}"
         mkdir $FILENAME
      fi
      echo -e "${txtgrn}Moving $i to $FILENAME${txtrst}"
      mv $i $FILENAME/
   done
else
   echo -e "${bldred}No ISO's to processing in current folder.${txtrst}"
fi
echo -e "${bldgrn}Scanning folders...${txtrst}"
for z in `ls -d */`
do
   echo -e "${bldgrn}Processing Folder: $z${txtrst}"
   cd $z
   #prepare
   ISOS=$((ls *.iso) 2>/dev/null)
   if [[ $ISOS ]]; then
      for i in `ls *.iso`
      do
         if ! [[ -d edit ]]; then mkdir edit; fi
         if ! [[ -d extract-cd ]]; then mkdir extract-cd; fi
         if ! [[ -d mnt ]]; then mkdir mnt; fi
         if ! [[ -d squashfs ]]; then mkdir squashfs; fi
#mount & extract   
         if [[ -f $i ]]; then
            echo -e "${bldgrn}Mounting $i${txtrst}"
            ENGAGEMOUNT=$(mount -o loop $i mnt/  2>/dev/null)
            echo -e "${bldgrn}Syncronising $i${txtrst}"
            rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
            echo -e "${bldgrn}Mounting SquashFs${txtrst}"
            mount -t squashfs -o loop mnt/casper/filesystem.squashfs squashfs
            echo -e "${bldgrn}Copying SquashFs${txtrst}"
            cp -a squashfs/* edit/
            echo -e "${bldgrn}Unmounting SquashFS${txtrst}"
            umount squashfs/
            echo -e "${bldgrn}Unmounting $i${txtrst}"
            umount mnt/
#            echo -e "${bldred}Failure mounting $i, exiting...${txtrst}"
#            exit 0
            #fi
         fi
         echo -e "${bldgrn}Cleaning up...${txtrst}"
         if [[ -d mnt ]]; then rm -R mnt; fi
         if [[ -d squashfs ]]; then rm -R squashfs; fi
         SUCCESS=$(ls edit/)
         if [[ $SUCCESS ]]; then
            if [[ -f $i ]]; then rm $i; fi
         else
            echo -e "${bldred}ERROR: Syncronisation error, not deleting $i${txtrst}. Are you a superuser?${txtrst}"
            exit 0;
         fi
      done
   fi
   cd $CURRENT
done

## Initiate upgrade process...
if [[ $1 ]]; then
   echo -e "${gldgrn}Upgrading Ultimate Edition $CVERSION to $1"
   cd $CURRENT
   for z in `ls -d */`
   do
      cd $z
      echo -e "${bldgrn}Initiating the upgrade process for $z"
      chroot edit apt-get update
   done
fi


Just to show you where I am going with it enter:
Code: Select all
./super-upgrade 3.4.3

I will do all the O/S upgrades by hand this time around, I will comeback and retouch this script when I have time.