Linux Lite Forums

Development => Linux Lite Software Development => Topic started by: Jerry on December 10, 2014, 02:52:18 AM

Title: Upgrade Script
Post by: Jerry on December 10, 2014, 02:52:18 AM
Looking to give people a way to upgrade, interactively and easily. The upgrade will ONLY be applicable for LL series releases ie. You will be able to upgrade from any version in the 2.0 - 2.8 series, but not from the 2.0 to a future 3.0 series.

This feature has been requested a lot. The script is in it's infancy, there is still much to do. If you'd like to test do the following:

1) Do a fresh install of 2.0 to a Virtualbox.
2) Make a file called lite-upgrade and make it executable.
2) Copy the script to /usr/bin
3) Click on the Whisker Menu and type in: gksudo lite-upgrade in the search box. Follow the prompts.

Of course I welcome code contributions and suggestions :)

This is what I have so far:

Code: [Select]
#!/bin/bash
#------------------------------------------------------------
# Description: Linux Lite Upgrade Script
# Author: Jerry Bezencon 2014
# Website: https://www.linuxliteos.com
#------------------------------------------------------------

# Ensure multi-language support
export LANG=C

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]
then
   sudo killall -9 synaptic
else
   echo""
fi

if [ -z "$(pgrep gdebi-gtk)" ]
then
   echo ""
else
   killall -9 gdebi-gtk
fi

# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# Get list of available updated packages
zenity --question --title="Linux Lite Upgrade Utility" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now Upgrade to Linux Lite 2.2\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )

# Erase existing available info
sudo dpkg --clear-avail

  else
       exit 0
  fi

# Install new packages, remove obsolete packages, clean up
x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade \-y && sudo apt-get install inxi libreoffice-gnome dmz-cursor-theme file-roller lite-welcome lite-cleaner catfish deja-dup system-config-date light-locker thunar-archive-plugin \-y && sudo apt-get remove xarchiver \-y && sudo apt-get autoremove \-y && sudo apt-get clean )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Upgrading to Linux Lite 2.2..." --pulsate \
--width=600 --auto-close )

# Reboot dialogue
# Credit to xunil: http://bbs.archbang.org/viewtopic.php?id=279
title="Select Reboot to complete the Upgrade"
exit_type=`zenity  --width="380" --height="220" --title="$title" --list --radiolist --column="Select" \
    --column="Exit Type" --column="Description" \
    TRUE "Reboot" "Reboot your computer"\
    FALSE "Shutdown" "Shutdown your computer"\
    FALSE "Cancel" "Continue using your computer" `

# User must select a target type (Check if they cancelled)
if [ ! "$exit_type" ]; then
    zenity --error --title="Error" --text="You must make a selection"
    exit
fi

# Action to perform by user
if [ "$exit_type" = "Reboot" ]
then

        # Do Reboot here
        sudo shutdown -r now | zenity --progress --percentage=95 --title=Reboot --auto-close --auto-kill --no-cancel --width=300


elif [ "$exit_type" = "Shutdown" ]
then
    # Do Shutdown here
    sudo shutdown -h now | zenity --progress --percentage=95 --title=Shutdown --auto-close --auto-kill --no-cancel --width=300

else

    # Do Cancel here
    exit 0
fi

# Set lite-welcome to autostart on first boot - to do
# command here

# Add new wallapapers
# command here

# Change launchers from xdg-open to exo-open - to do
# command here

# Add new right click actions to Thunar - to do
# command here

# Update plymouth, lsb_release and issue files - to do
# command here

# Update to new login screen - to do
# command here

# Remove obsolete PPA's - to do
# command here
Title: Re: Upgrade Script
Post by: sysdrum on December 10, 2014, 03:02:14 AM
I like it.
Title: Re: Upgrade Script
Post by: anon222 on December 12, 2014, 04:57:33 PM
First we must ensure that the script doesn't brake anything
apt-get upgrade -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
Code: [Select]
#!/bin/bash
#------------------------------------------------------------
# Description: Linux Lite Upgrade Script
# Author: Jerry Bezencon 2014
# Website: https://www.linuxliteos.com
#------------------------------------------------------------

# Ensure multi-language support
export LANG=C

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]
then
   sudo killall -9 synaptic
else
   echo""
fi

if [ -z "$(pgrep gdebi-gtk)" ]
then
   echo ""
else
   killall -9 gdebi-gtk
fi

# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# Get list of available updated packages
zenity --question --title="Linux Lite Upgrade Utility" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now Upgrade to Linux Lite 2.2\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed 's/^/#/g' |
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )

# Erase existing available info
sudo dpkg --clear-avail

  else
       exit 0
  fi

# Install new packages, remove obsolete packages, clean up
x=$( stdbuf -oL /bin/bash \-c '(stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"  && sudo apt-get install inxi libreoffice-gnome dmz-cursor-theme file-roller lite-welcome lite-cleaner catfish deja-dup system-config-date light-locker thunar-archive-plugin \-y && sudo apt-get remove xarchiver \-y && sudo apt-get autoremove \-y && sudo apt-get clean )' 2>&1 |
stdbuf -oL sed 's/^/#/g' |
zenity --progress --title="Upgrading to Linux Lite 2.2..." --pulsate \
--width=600 --auto-close )

# Reboot dialogue
# Credit to xunil: http://bbs.archbang.org/viewtopic.php?id=279
title="Select Reboot to complete the Upgrade"
exit_type=`zenity  --width="380" --height="220" --title="$title" --list --radiolist --column="Select" \
    --column="Exit Type" --column="Description" \
    TRUE "Reboot" "Reboot your computer"\
    FALSE "Shutdown" "Shutdown your computer"\
    FALSE "Cancel" "Continue using your computer" `

# User must select a target type (Check if they cancelled)
if [ ! "$exit_type" ]; then
    zenity --error --title="Error" --text="You must make a selection"
    exit
fi

# Action to perform by user
if [ "$exit_type" = "Reboot" ]
then

        # Do Reboot here
        sudo shutdown -r now | zenity --progress --percentage=95 --title=Reboot --auto-close --auto-kill --no-cancel --width=300


elif [ "$exit_type" = "Shutdown" ]
then
    # Do Shutdown here
    sudo shutdown -h now | zenity --progress --percentage=95 --title=Shutdown --auto-close --auto-kill --no-cancel --width=300

else

    # Do Cancel here
    exit 0
fi

# Set lite-welcome to autostart on first boot - to do
# command here

# Add new wallapapers
# command here

# Change launchers from xdg-open to exo-open - to do
# command here

# Add new right click actions to Thunar - to do
# command here

# Update plymouth, lsb_release and issue files - to do
# command here

# Update to new login screen - to do
# command here

# Remove obsolete PPA's - to do
# command here
New wallpapers could be packed into package for example lite-wallpapers-2.2 or similar.
Title: Re: Upgrade Script
Post by: altman on December 12, 2014, 05:03:05 PM
Thanx Misko , I don t know how you guys do these ! You must be a computer whiz kid ! ( in a good way )

Will it be Default on next ISO Install CD !
Title: Re: Upgrade Script
Post by: anon222 on December 12, 2014, 05:19:05 PM
Ha,ha, thanks.
I'm a 30 year old kid.  ;D

Will it be Default on next ISO Install CD?
I don't know. That's along way to go.
Title: Re: Upgrade Script
Post by: N4RPS on December 22, 2014, 02:55:04 AM
Hello!

Wish you folks the best on this.  I'm starting to forget everything I've installed when I 'upgrade', so this will be a BIG help!

73 DE N4RPS
Rob
Title: Re: Upgrade Script
Post by: altman on December 27, 2014, 11:16:15 AM
Ha,ha, thanks.
I'm a 30 year old kid.  ;D

Will it be Default on next ISO Install CD?
I don't know. That's along way to go.

Lol , yep , same here , 49yo kid !

Will check on next iso release if installed by default . Will be a little while since LL2.2 Finale s only got released .
Title: Re: Upgrade Script
Post by: Wirezfree on January 02, 2015, 06:33:47 AM
Hi,

I realise you folks are really busy, and have many things to do...

Wondering how is the upgrade tool progressing?
I only have 3 machines, but would like to keep them in sync.

Thanks... Dave
Title: Re: Upgrade Script
Post by: Jerry on January 02, 2015, 01:20:16 PM
Hi,

I realise you folks are really busy, and have many things to do...

Wondering how is the upgrade tool progressing?
I only have 3 machines, but would like to keep them in sync.

Thanks... Dave

Work is progressing, I don't have a date Dave. It's a tricky script that has to be thoroughly tested to avoid worldwide breakages :p
Title: Re: Upgrade Script
Post by: Wirezfree on January 02, 2015, 01:49:52 PM
Hi Jerry,

Thanks... Fully Understand...
I guess after years of Windows, and now making the move..
I'm eager to get/keep all machines at the same level/revision.

I will wait patiently

Dave
Title: Re: Upgrade Script
Post by: Jerry on January 30, 2015, 08:51:54 PM
UPDATE: Making some good progress here lately, I've been able to push through some tricky problems. The update script for now will be split into 2 files, the system upgrade and the home upgrade, so initially there will be 2 files to run. This may change in time, we'll see. Taking this approach for now has at least allowed me to make greater progress, more quickly.

Ive tested the system upgrade file and it works well. The home upgrade file is being tested and is approaching completion.
Title: Re: Upgrade Script
Post by: Wirezfree on January 31, 2015, 04:50:53 AM
Thanks for the update...
Great news... Dave
Title: Re: Upgrade Script
Post by: bitsnpcs on January 31, 2015, 10:49:28 AM
Thank You Jerry for the update info, and work that is going in to the update scripts.
Title: Re: Upgrade Script
Post by: altman on January 31, 2015, 09:29:07 PM
Thanx for the update Jerry .
Title: Re: Upgrade Script
Post by: Jerry on January 31, 2015, 11:25:05 PM
The upgrade process is now ready for release. Let me state that this has only been tested on a fresh install of Linux Lite 2.0, not on an existing machine.

Disclaimer:
This is provided as beta quality. The upgrader backs up any files that it changes so things can be restored if needed. If you have more than 1 LL 2.0 machine, do this on one to start with and assess the results. You should also do a full system back up before proceeding. Systemback or Timeshift as have been previously discussed in these Forums is advised.


There are 2 files. lite-upgrade, this is run first and upgrades your system files to Linux Lite 2.2 and home-upgrade, this updates your home folder as well.

Let's go.

1.) Open a terminal and do:

Code: [Select]
touch home-upgrade lite-upgrade
2.) Open home-upgrade with your text editor and fill with the following contents:

Code: [Select]
#!/bin/bash
#----------------------------------------------------------------
# Description: Linux Lite Upgrade Script
# Authors: Misko_2083, Jerry Bezencon 2015
# Website: https://www.linuxliteos.com
#----------------------------------------------------------------

# Ensure multi-language support
export LANG=C

# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# First dialogue box
zenity --question --title="Linux Lite Upgrade Utility" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now complete the Upgrade to Linux Lite 2.2\n\nPlease ensure ALL applications are closed.\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

# Create Backup folders first
mkdir -p /home/$USER/.llupgradebackup/2.0-2.2
mkdir -p /etc/skel/.llupgradebackup/2.0-2.2

# Copy all original files from /home/user and /etc/skel to their respective backup folders and versions

# Backup /home/$USER/ first
cp /home/$USER/.config/xfce4/panel/whiskermenu-1.rc /home/$USER/.llupgradebackup/2.0-2.2
cp /home/$USER/.local/share/applications/exo-terminal-emulator.desktop /home/$USER/.llupgradebackup/2.0-2.2
cp /home/$USER/.local/share/applications/alacarte-made-2.desktop /home/$USER/.llupgradebackup/2.0-2.2
cp /home/$USER/.local/share/applications/alacarte-made-4.desktop /home/$USER/.llupgradebackup/2.0-2.2
cp /home/$USER/.local/share/applications/alacarte-made-5.desktop /home/$USER/.llupgradebackup/2.0-2.2
cp /home/$USER/.local/share/applications/alacarte-made-6.desktop /home/$USER/.llupgradebackup/2.0-2.2
cp /home/$USER/.local/share/applications/alacarte-made-7.desktop /home/$USER/.llupgradebackup/2.0-2.2
cp /home/$USER/.config/Thunar/uca.xml /home/$USER/.llupgradebackup/2.0-2.2

# Then backup /etc/skel/
cp /etc/skel/.config/xfce4/panel/whiskermenu-1.rc /etc/skel/.llupgradebackup/2.0-2.2
cp /etc/skel/.local/share/applications/exo-terminal-emulator.desktop /etc/skel/.llupgradebackup/2.0-2.2
cp /etc/skel/.local/share/applications/alacarte-made-2.desktop /etc/skel/.llupgradebackup/2.0-2.2
cp /etc/skel/.local/share/applications/alacarte-made-4.desktop /etc/skel/.llupgradebackup/2.0-2.2
cp /etc/skel/.local/share/applications/alacarte-made-5.desktop /etc/skel/.llupgradebackup/2.0-2.2
cp /etc/skel/.local/share/applications/alacarte-made-6.desktop /etc/skel/.llupgradebackup/2.0-2.2
cp /etc/skel/.local/share/applications/alacarte-made-7.desktop /etc/skel/.llupgradebackup/2.0-2.2
cp /etc/skel/.config/Thunar/uca.xml /etc/skel/.llupgradebackup/2.0-2.2

# Set lite-welcome to autostart on first boot
ln -s /usr/share/applications/lite_welcome.desktop /home/$USER/.config/autostart

# Whisker Menu - changes /home/$USER/.config/xfce4/panel/whiskermenu-1.rc
sed -i "s/command-lockscreen=xflock4/command-lockscreen=light-locker-command -l/g" /home/$USER/.config/xfce4/panel/whiskermenu-1.rc
dbus-send --print-reply --dest=org.xfce.Panel /org/xfce/Panel org.xfce.Panel.Terminate boolean:true
cp /home/$USER/.config/xfce4/panel/whiskermenu-1.rc /etc/skel/.config/xfce4/panel/

# Change launchers from xdg-open to exo-open - to do (path is /home/$USER/.local/share/applications/)
# In 32bit version, file are: exo-terminal-emulator.desktop, alacarte-made-2.desktop, alacarte-made-4.desktop, alacarte-made-5.desktop, alacarte-made-6.desktop
# In 64bit version, file are: exo-terminal-emulator.desktop, Thunar.desktop, alacarte-made-2.desktop
sed -i "s/Exec=xdg-open/Exec=exo-open/g" /home/$USER/.local/share/applications/exo-terminal-emulator.desktop
sed -i "s/Exec=xdg-open/Exec=exo-open/g" /home/$USER/.local/share/applications/alacarte-made-2.desktop
sed -i "s/Exec=xdg-open/Exec=exo-open/g" /home/$USER/.local/share/applications/alacarte-made-4.desktop
sed -i "s/Exec=xdg-open/Exec=exo-open/g" /home/$USER/.local/share/applications/alacarte-made-5.desktop
sed -i "s/Exec=xdg-open/Exec=exo-open/g" /home/$USER/.local/share/applications/alacarte-made-6.desktop
cp /home/$USER/.local/share/applications/exo-terminal-emulator.desktop /etc/skel/.local/share/applications/
cp /home/$USER/.local/share/applications/alacarte-made-2.desktop /etc/skel/.local/share/applications/
cp /home/$USER/.local/share/applications/alacarte-made-4.desktop /etc/skel/.local/share/applications/
cp /home/$USER/.local/share/applications/alacarte-made-5.desktop /etc/skel/.local/share/applications/
cp /home/$USER/.local/share/applications/alacarte-made-6.desktop /etc/skel/.local/share/applications/

# Implement new Create System Report changes - to do (path is /home/$USER/.local/share/applications/)
# In 32bit version, file is: alacarte-made-7.desktop
# In 64bit version, file is: alacarte-made-8.desktop
# Change - Exec=x-terminal-emulator --geometry=95x25 -t "Create System Report" -e /usr/scripts/info ##to## Exec=gksudo /usr/scripts/systemreport
mv /home/$USER/.local/share/applications/alacarte-made-7.desktop /home/$USER/.local/share/applications/alacarte-made-7.desktop.backup
touch /home/$USER/.local/share/applications/alacarte-made-7.desktop
echo "[Desktop Entry]" > /home/$USER/.local/share/applications/alacarte-made-7.desktop
echo "Comment=Create a detailed System Report of your computer" >> /home/$USER/.local/share/applications/alacarte-made-7.desktop
echo "Terminal=false" >> /home/$USER/.local/share/applications/alacarte-made-7.desktop
echo "Name=Create System Report" >> /home/$USER/.local/share/applications/alacarte-made-7.desktop
echo "Exec=gksudo /usr/scripts/systemreport" >> /home/$USER/.local/share/applications/alacarte-made-7.desktop
echo "Type=Application" >> /home/$USER/.local/share/applications/alacarte-made-7.desktop
echo "Icon=evolution-tasks" >> /home/$USER/.local/share/applications/alacarte-made-7.desktop
cp /home/$USER/.local/share/applications/alacarte-made-7.desktop /etc/skel/.local/share/applications/

# Add new right click actions to Thunar - to do (path is /home/$USER/.config/Thunar/uca.xml)
sed -i '$ d' /home/$USER/.config/Thunar/uca.xml
echo '<action>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <icon>media-optical</icon>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <name>Check MD5SUM</name>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <unique-id>1422219337486382-1</unique-id>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <command>zenity --info --title="Check MD5 for %n" --text="$(md5sum %f)"</command>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <description>Checks the MD5SUM of an image file</description>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <patterns>*.iso;*.ISO;*.img;*.IMG</patterns>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <audio-files/>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <image-files/>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <other-files/>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <text-files/>' >> /home/$USER/.config/Thunar/uca.xml
echo '    <video-files/>' >> /home/$USER/.config/Thunar/uca.xml
echo '</action>' >> /home/$USER/.config/Thunar/uca.xml
echo '</actions>' >> /home/$USER/.config/Thunar/uca.xml
cp /home/$USER/.config/Thunar/uca.xml /etc/skel/.config/Thunar/
thunar -q

# Clean up
rm -rf /home/$USER/.local/share/applications/xarchiver.desktop
rm -rf /etc/skel/.local/share/applications/xarchiver.desktop | zenity --progress --title="Upgrade test..." --window-icon="/usr/share/icons/zenity-llcc.png" --text="Please wait whilst the upgrade completes..." --pulsate --width=400 --auto-close --auto-kill

                                if [ "${PIPESTATUS[0]}" -ne "0" ]; then
                       
                                        zenity --error \
                                        --title="Error" --text="Upgrades could not be installed."
                                        exit 0
                                fi

                else

                                        exit 0
                fi

# Ask to view upgrade log - TO DO
# example of log inclusion - x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
# PROCEED=$(zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="Updates have finished installing.\n\nWould you like to view the $APPNAME Updates log?"; echo $?)
# if [ ${PROCEED} -eq 1 ]; then
#   zenity --info --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="$APPNAME Updates Complete."
#   exit;
# else
#   zenity --text-info --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
# fi

# exit 0

# End dialogue
PROCEED=$(zenity --info --title="Upgrade Complete" --window-icon=/usr/share/icons/zenity-llcc.png --text="The upgrade has finished.\nYou can start using your computer straight away."; echo $?)
if [ ${PROCEED} -eq 1 ]; then
    zenity --info --title="Upgrade Complete" --window-icon="${INSTALL_ICON}" --text="The upgrade has finished.\nYou can start using your computer straight away"
    exit;
else
    lite-welcome
fi

exit 0

Save and close. Then right click on the file and select 'Make file executable'

3.) Open lite-upgrade with your text editor and fill with the following contents:

Code: [Select]
#!/bin/bash
#----------------------------------------------------------------
# Description: Linux Lite Upgrade Script
# Authors: Misko_2083, Jerry Bezencon 2015
# Website: https://www.linuxliteos.com
#----------------------------------------------------------------

# Ensure multi-language support
export LANG=C

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]
then
   sudo killall -9 synaptic
else
   echo""
fi

if [ -z "$(pgrep gdebi-gtk)" ]
then
   echo ""
else
   killall -9 gdebi-gtk
fi

# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# Get list of available updated packages
zenity --question --title="Linux Lite Upgrade Utility" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now Upgrade your system to Linux Lite 2.2\n\nPlease ensure you are connected to the internet before you start.\n\nAt the end of this upgrade, please reboot and complete the upgrade process.\n\nClick Yes to continue or No to abort."
   if [ "$?" -eq "0" ];then

x=$( stdbuf -oL /bin/bash \-c '(sudo apt-get update \-y )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating package information..." --pulsate \
--width=600 --auto-close )

# Erase existing available info
sudo dpkg --clear-avail

  else
       exit 0
  fi

# Create /etc/apt/apt.conf.d/local to leave /etc/issue and /etc/lsb-release defaults (only needed in LL 2.2)
x=$( stdbuf -oL /bin/bash \-c '(cd /tmp && wget http://repo.linuxliteos.com/upgrade/local && sudo mv local /etc/apt/apt.conf.d/ && sudo chown root:root /etc/apt/apt.conf.d/local && sleep 2 )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Automating default configuration..." --pulsate \
--width=600 --auto-close )

# Install new packages, remove obsolete packages, clean up
x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade \-y && sudo apt-get install inxi libreoffice-gnome dmz-cursor-theme file-roller lite-welcome lite-cleaner catfish deja-dup system-config-date light-locker thunar-archive-plugin whiskermenu \-y && sudo apt-get update \-y && sudo apt-get remove xarchiver \-y && sudo apt-get autoremove \-y && sudo apt-get clean )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Upgrading to Linux Lite 2.2..." --pulsate \
--width=600 --auto-close )

# Add new wallpapers
x=$( stdbuf -oL /bin/bash \-c '(cd /tmp && wget http://repo.linuxliteos.com/upgrade/2.0-2.2/walls-2.2.tar.gz && sudo tar -xvf walls-2.2.tar.gz -C /usr/share/backgrounds/xfce/ && cd /usr/share/backgrounds/xfce/ && sudo chown root:root *.jpg && sudo chown root:root *.png && sleep 2 )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Adding new wallapapers..." --pulsate \
--width=600 --auto-close )

# Update plymouth, lsb_release and issue files /etc changes
x=$( stdbuf -oL /bin/bash \-c '(sudo sed -i "s/Linux Lite 2.0/Linux Lite 2.2/g" /etc/llver && sudo sed -i "s/Linux Lite 2.0/Linux Lite 2.2/g" /etc/lsb-release && sudo sed -i "s/Linux Lite 2.0/Linux Lite 2.2/g" /etc/issue && sleep 2 )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating version information..." --pulsate \
--width=600 --auto-close )

# /lib/plymouth/themes/ubuntu-text/ changes
x=$( stdbuf -oL /bin/bash \-c '(sudo sed -i "s/Ubuntu 14.04/Linux Lite 2.2/g" /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth && sudo sed -i "s/black=0x2c001e/black=0x000000/g" /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth && sudo sed -i "s/white=0xffffff/white=0xffffff/g" /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth && sudo sed -i "s/brown=0xff4012/brown=0xffff00/g" /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth && sudo sed -i "s/blue=0x988592/blue=0x000000/g" /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth && sudo update-initramfs -u )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating boot configuration please wait..." --pulsate \
--width=600 --auto-close )

# Update to new login screen
x=$( stdbuf -oL /bin/bash \-c '(cd /tmp && wget https://github.com/linuxlite/litelogin/archive/master.zip && unzip master.zip && sudo cp /tmp/litelogin-master/usr/share/lightdm-webkit/themes/linuxlite/index.theme /usr/share/lightdm-webkit/themes/linuxlite && sudo cp /tmp/litelogin-master/usr/share/lightdm-webkit/themes/linuxlite/index.html /usr/share/lightdm-webkit/themes/linuxlite && sudo cp /tmp/litelogin-master/usr/share/lightdm-webkit/themes/linuxlite/low_contrast_linen.png /usr/share/lightdm-webkit/themes/linuxlite && sudo cp /tmp/litelogin-master/usr/share/lightdm-webkit/themes/linuxlite/style.css /usr/share/lightdm-webkit/themes/linuxlite && sudo rm -rf master.zip && sudo rm -rf litelogin-master/ && sleep 2 )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating to new login theme..." --pulsate \
--width=600 --auto-close )

# Ask to view upgrade log - TO DO
# example of log inclusion - x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
# PROCEED=$(zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="Updates have finished installing.\n\nWould you like to view the $APPNAME Updates log?"; echo $?)
# if [ ${PROCEED} -eq 1 ]; then
#   zenity --info --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="$APPNAME Updates Complete."
#   exit;
# else
#   zenity --text-info --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
# fi

# exit 0

# Reboot dialogue
# Credit to xunil: http://bbs.archbang.org/viewtopic.php?id=279
title="Select Reboot to complete the System Upgrade"
exit_type=`zenity  --width="400" --height="220" --title="$title" --list --radiolist --column="Select" \
    --column="Exit Type" --column="Description" \
    TRUE "Reboot" "Reboot your computer"\
    FALSE "Shutdown" "Shutdown your computer"\
    FALSE "Cancel" "Continue using your computer" `

# User must select a target type (Check if they cancelled)
if [ ! "$exit_type" ]; then
    zenity --error --title="Error" --text="You must make a selection"
    exit
fi

# Action to perform by user
if [ "$exit_type" = "Reboot" ]
then

        # Do Reboot here
        sudo shutdown -r now | zenity --progress --percentage=95 --title=Reboot --auto-close --auto-kill --no-cancel --width=300


elif [ "$exit_type" = "Shutdown" ]
then
    # Do Shutdown here
    sudo shutdown -h now | zenity --progress --percentage=95 --title=Shutdown --auto-close --auto-kill --no-cancel --width=300

else

    # Do Cancel here
    exit 0
fi

Save and close.

4.) With your terminal still open do:

Code: [Select]
sudo cp lite-upgrade /usr/bin  && sudo chmod +x /usr/bin/lite-upgrade
5.) Click on Menu, in the run box type in: gksudo lite-upgrade and follow the onscreen instructions.

When that process is complete and you have rebooted, go to your home folder and double click on home-upgrade to complete the upgrade.

If there is more than one user on your computer, you need to run the home-upgrade installer for each user. No need to run lite-upgrade for each user.

Looking forward to see how this goes.
Title: Re: Upgrade Script
Post by: bitsnpcs on February 02, 2015, 06:50:22 PM
Hello Jerry,

Congratulations on the release of the update script.
Thank you for all the work on the upgrade process.

I will be following the update script tutorial this week, on my usual LL install (not a fresh install), and will reply on how it goes.
Title: Re: Upgrade Script
Post by: banko on February 03, 2015, 10:11:22 AM
Misko and Jerry,

Just letting you know, I've upgraded my old netbook, using your script, without any problem at all :D

I had installed LL 2.0 early Dec and did not have much on it, only things not important, so I just went for it ( no problem if I messed it up).

It took about 45 mins to do it all, including reboot.

Everything was there as it was before upgrade.

So far, more than impressed and very grateful.

So a massive thanks to you both :D

Keith
Title: Re: Upgrade Script
Post by: Jerry on February 03, 2015, 12:10:44 PM
Misko and Jerry,

Just letting you know, I've upgraded my old netbook, using your script, without any problem at all :D

I had installed LL 2.0 early Dec and did not have much on it, only things not important, so I just went for it ( no problem if I messed it up).

It took about 45 mins to do it all, including reboot.

Everything was there as it was before upgrade.

So far, more than impressed and very grateful.

So a massive thanks to you both :D

Keith

Thanks for the feedback Keith :)
Title: Re: Upgrade Script
Post by: N4RPS on February 05, 2015, 06:30:30 AM
Hello!

I've got several here that I haven't bother to upgrade because I didn't think 2.2 was significant enough of an upgrade to have to reinstall EVERYTHING on EVERY machine here. I guess I'll make a pretty good guinea pig, because between all the different machines, I have a mix of programs. Right now, the problem is finding the time.

I am working on three different websites. Two are for non-profit organizations. I have found that BlueGriffon is the best WYSIWYG HTML editor out there, regardless of platform. Kompozer just doesn't display web sites nearly as well.

If anyone else out there is using one that's better, lets us know. But PLEASE, start another thread, for Jerry's sake.

I've made a New Year's resolution to not drift off-topic. I plan to keep it...

73 DE N4RPS
Rob
Title: Re: Upgrade Script
Post by: bitsnpcs on February 05, 2015, 12:46:32 PM
Hello Jerry and misko,

the upgrade went smoothly, it took 19 minutes to complete, including checking for updates after completion.
All is working correctly with zero errors after upgrade.
Title: Re: Upgrade Script
Post by: Wirezfree on February 05, 2015, 01:56:04 PM
Hi Jerry & Misko,

Updated...

Tested on my HP Laptop i5-4200u not i5-4500u
Including re-boot the upgrade took approx 7 mins, the home-upgrade part seemed to be almost instantaneous.

All appears to be working fine, tested networking, printing and common apps.

Many Thanks... Dave
Title: Re: Upgrade Script
Post by: Jerry on February 05, 2015, 10:06:29 PM
Hello Jerry and misko,

the upgrade went smoothly, it took 19 minutes to complete, including checking for updates after completion.
All is working correctly with zero errors after upgrade.

Brilliant, thank you for responding bitsnpcs :)
Title: Re: Upgrade Script
Post by: Jerry on February 05, 2015, 10:08:31 PM
Hi Jerry & Misko,

Tested on my HP Laptop i5-4500u
Including re-boot the upgrade took approx 7 mins, the home-upgrade part seemed to be almost instantaneous.

All appears to be working fine, tested networking, printing and common apps.

Many Thanks... Dave

Thanks for letting us know Dave. The home-upgrade part should be very quick, it backs up a few kilobytes worth of files, then modifies existing ones. Lots of code but small outcome :)
Title: Re: Upgrade Script
Post by: bitsnpcs on February 05, 2015, 11:26:38 PM
Hello Jerry and misko,

the upgrade went smoothly, it took 19 minutes to complete, including checking for updates after completion.
All is working correctly with zero errors after upgrade.

Brilliant, thank you for responding bitsnpcs :)

I forgot to add the system info, it is a P4 2.0Ghz, 1Gb RAM.
Title: Re: Upgrade Script
Post by: riser on February 06, 2015, 01:04:49 PM
Hi Jerry,

I plan on testing this process sometime this month.  I was not looking forward to a full clean LL 2.2 install given all the customization I have make, but always wanted the increased speed and latest packages.

I took a look at the script and would like to suggest some code changes for easier maintenance and reduced overhead.  Feel free to ignore, and I must mention this code is not fully tested (I tested bits of changes to ensure the resulting commands are equivalent).

riser

Code: [Select]

#!/bin/bash
#----------------------------------------------------------------
# Description: Linux Lite Upgrade Script
# Authors: Misko_2083, Jerry Bezencon 2015
# Website: https://www.linuxliteos.com
#----------------------------------------------------------------

# Use zenity to execute the passed-in command
run_command() {
    stdbuf -oL /bin/bash -c "$1" | stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/*$/ s/^/# /p' | zenity --progress --title="$2" --pulsate --width=600 --auto-close
    return $?
}

# Ensure multi-language support
export LANG=C

# Kill off any package managers that may be running
if [ "$(pidof synaptic)" ]; then
   sudo killall -9 synaptic
else
   echo ""
fi

if [ -z "$(pgrep gdebi-gtk)" ]; then
   echo ""
else
   killall -9 gdebi-gtk
fi

# Linux Lite default dialog icon
ic="/usr/share/icons/zenity-llcc.png"

# Get list of available updated packages
zenity --question --title="Linux Lite Upgrade Utility" --window-icon="/usr/share/icons/zenity-llcc.png" --text="We will now Upgrade your system to Linux Lite 2.2\n\nPlease ensure you are connected to the internet before you start.\n\nAt the end of this upgrade, please reboot and complete the upgrade process.\n\nClick Yes to continue or No to abort."

if [ "$?" -ne "0" ]; then
   exit 0
fi

# Update packages
x=run_command 'sudo apt-get update \-y' 'Updating package information...'

# Erase existing available info
sudo dpkg --clear-avail

# Create /etc/apt/apt.conf.d/local to leave /etc/issue and /etc/lsb-release defaults (only needed in LL 2.2)
x=run_command 'cd /tmp && wget http://repo.linuxliteos.com/upgrade/local && sudo mv local /etc/apt/apt.conf.d/ && sudo chown root:root /etc/apt/apt.conf.d/local && sleep 2' 'Automating default configuration...'

# Install new packages, remove obsolete packages, clean up
x=run_command 'sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade \-y && sudo apt-get install inxi libreoffice-gnome dmz-cursor-theme file-roller lite-welcome lite-cleaner catfish deja-dup system-config-date light-locker thunar-archive-plugin whiskermenu \-y && sudo apt-get update \-y && sudo apt-get remove xarchiver \-y && sudo apt-get autoremove \-y && sudo apt-get clean' 'Upgrading to Linux Lite 2.2...'

# Add new wallpapers
x=run_command 'cd /tmp && wget http://repo.linuxliteos.com/upgrade/2.0-2.2/walls-2.2.tar.gz && sudo tar -xvf walls-2.2.tar.gz -C /usr/share/backgrounds/xfce/ && cd /usr/share/backgrounds/xfce/ && sudo chown root:root *.jpg && sudo chown root:root *.png && sleep 2' 'Adding new wallapapers...'

# Update plymouth, lsb_release and issue files /etc changes
x=run_command 'sudo sed -i "s/Linux Lite 2.0/Linux Lite 2.2/g" /etc/llver && sudo sed -i "s/Linux Lite 2.0/Linux Lite 2.2/g" /etc/lsb-release && sudo sed -i "s/Linux Lite 2.0/Linux Lite 2.2/g" /etc/issue && sleep 2' 'Updating version information...'

# /lib/plymouth/themes/ubuntu-text/ changes
echo "s/Ubuntu 14.04/Linux Lite 2.2/g
s/black=0x2c001e/black=0x000000/g
s/white=0xffffff/white=0xffffff/g
s/brown=0xff4012/brown=0xffff00/g
s/blue=0x988592/blue=0x000000/g" > /tmp/sed_rules.$$
x=run_command 'sudo sed -i -f /tmp/sed_rules.$$ /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth && sudo update-initramfs -u' 'Updating boot configuration please wait...'

# Update to new login screen
x=run_command 'cd /tmp && wget https://github.com/linuxlite/litelogin/archive/master.zip && unzip master.zip && for FILE in index.theme index.html low_contrast_linen.png style.css; do sudo cp /tmp/litelogin-master/usr/share/lightdm-webkit/themes/linuxlite/$FILE /usr/share/lightdm-webkit/themes/linuxlite; done && sudo rm -rf master.zip && sudo rm -rf litelogin-master/ && sleep 2' 'Updating to new login theme...'

# Ask to view upgrade log - TO DO
# example of log inclusion - x=$( stdbuf -oL /bin/bash \-c '(sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade \-y )' 2>&1 | tee /var/log/llupdates.log |
# PROCEED=$(zenity --question --title="$APPNAME Updates" --window-icon=/usr/share/icons/zenity-llcc.png --text="Updates have finished installing.\n\nWould you like to view the $APPNAME Updates log?"; echo $?)
# if [ ${PROCEED} -eq 1 ]; then
#   zenity --info --title="$APPNAME Updates" --window-icon="${INSTALL_ICON}" --text="$APPNAME Updates Complete."
#   exit;
# else
#   zenity --text-info --ok-label="Quit" --cancel-label="Cancel" --title="Updates Log" --width=700 --height=300 --filename="/var/log/llupdates.log"
# fi

# exit 0

# Reboot dialogue
# Credit to xunil: http://bbs.archbang.org/viewtopic.php?id=279
title="Select Reboot to complete the System Upgrade"
exit_type=`zenity  --width="400" --height="220" --title="$title" --list --radiolist --column="Select" \
    --column="Exit Type" --column="Description" \
    TRUE "Reboot" "Reboot your computer"\
    FALSE "Shutdown" "Shutdown your computer"\
    FALSE "Cancel" "Continue using your computer" `

# User must select a target type (Check if they cancelled)
if [ ! "$exit_type" ]; then
   zenity --error --title="Error" --text="You must make a selection"
    exit
fi

# Action to perform by user
if [ "$exit_type" = "Reboot" ]
then
    # Do Reboot here
    sudo shutdown -r now | zenity --progress --percentage=95 --title=Reboot --auto-close --auto-kill --no-cancel --width=300
elif [ "$exit_type" = "Shutdown" ]
then
    # Do Shutdown here
    sudo shutdown -h now | zenity --progress --percentage=95 --title=Shutdown --auto-close --auto-kill --no-cancel --width=300
else
    # Do Cancel here
    exit 0
fi
Title: Re: Upgrade Script
Post by: Jerry on February 06, 2015, 01:10:09 PM
Thank you riser, could you please edit your code to include #comments for any changes/additions.
Title: Re: Upgrade Script
Post by: riser on February 06, 2015, 01:35:30 PM
I essentially made 3 changes:
- Consolidate running zenity based commands using a function (so any changes to behavior are done in one place and code is cleaner)
- Replaced the multiple 'sed -i' replacements of the theme text with a single 'sed -f'
- Moved/changed logic to exit if user does not want to upgrade
Title: Re: Upgrade Script
Post by: banko on February 07, 2015, 03:19:29 AM
further to my post about the upgrade taking 45 mins,
I should have added that this was on a old netbook with a 16 gig SSD, which slow read write times made it almost unusable.
But LL made it at least usable and this 45 mins should be the maximum time anyone should take.

I think Dave's 7 minutes is pretty awesome.

Keith.
Title: Re: Upgrade Script
Post by: N4RPS on February 08, 2015, 11:58:02 PM
Hello!

I ran the upgrade script on a Samsung RV515-A03US with 8GB RAM and a 1TB HD, and it only took a couple of minutes to upgrade. This is a LOT less time than ANY of the Ubuntu upgrades take. Will keep you informed as I upgrade the other lappies around here.

I ended up with some leftover GRUB entries from 2.0, which I edited out with Grub Customizer. Other than that, it worked like a champ...

73 DE N4RPS
Rob

UPDATE: I upgraded the 32-bit 2.0 install on my Gateway Tablet PC (M285E, 2 GB RAM, 320GB HD) to 2.2. It was successful, but I had to run boot-repair on it to fix GRUB, then reinstalled grub-customizer. All better now, and what you came up with is certainly better than not being able to upgrade!

Did the upgrade on the HP nc6320 (4 GB RAM, 1 TB HD) after (temporarily) removing grub-customizer, and reinstalled GC afterward. No issues other than having to update the GRUB entries to reflect 2.2 instead of 2.0...
Title: Re: Upgrade Script
Post by: Jerry on February 09, 2015, 06:30:49 AM
Thanks Rob. I haven't decided yet the simplest way to deploy the upgrade process. We'll come up with something :)
Title: Re: Upgrade Script
Post by: N4RPS on February 10, 2015, 05:39:21 AM
Hello!

If it can be done, you'll figure out how. I don't see how it can be made much easier than it already is - unless you modify the scripts to make it ALL automatic...

73 DE N4RPS
Rob
Title: Re: Upgrade Script
Post by: Jerry on March 04, 2015, 01:19:35 AM
UPDATE:

I've re-written the upgrade script so that you can run one command, and enter your password once. This means that I can also make a package for it and therefore allow people to upgrade easily from within that LTS series eg. upgrade from 2.0 - 2.4

Upgrading will be as easy as, Menu, enter: lite-upgrade-s2 into the command box, and away she goes.

It's still needs some fine tuning but I have tested this on a fresh install of 2.0 and it does what it's supposed to :)
Title: Re: Upgrade Script
Post by: Wirezfree on March 04, 2015, 04:49:25 AM
@ Jerry,

Sounds really good, excellent news.

Can I clarify,
The aim is to have "1" script that will do any 2.x to the current 2.x
Due to my cautious nature, I still have 2 PC at 2.0 and 2 at 2.2
So this "1" script will bring all my PC's to the next release 2.4.?
No need to use the old 2.0 to 2.2 script.

Thanks... Dave
Title: Re: Upgrade Script
Post by: Jerry on March 04, 2015, 04:54:20 AM
@Dave - that is correct. Hell, even do 2.0 to 2.8 later on if you're feelin' lucky :)
Title: Re: Upgrade Script
Post by: Wirezfree on March 04, 2015, 07:14:52 AM
Hi Jerry,


Thanks for the confirmation... Dave


ps
((Puts on body armour & helmet & goggles first))
How about a 2.X to 3.0   ;D   ::)
Title: Re: Upgrade Script
Post by: bitsnpcs on March 04, 2015, 09:41:59 AM
Hell, even do 2.0 to 2.8 later on if you're feelin' lucky :)

Luck doesn't enter into it when we have such a talented and charmed Team  :)
Thank You.
Title: Re: Upgrade Script
Post by: Jerry on March 04, 2015, 09:49:01 AM

((Puts on body armour & helmet & goggles first))
How about a 2.X to 3.0   ;D   ::) 


Release the hounds!

Quote from: bitsnpcs

Luck doesn't enter into it when we have such a talented and charmed Team  :)
Thank You.



No, no thank you :)
Title: Re: Upgrade Script
Post by: Jerry on March 23, 2015, 07:50:27 AM
UPDATE: Script has undergone a lot of testing lately. I'm looking to put a link for people under Menu, System, Lite Upgrade.
Title: Re: Upgrade Script
Post by: Wirezfree on March 23, 2015, 10:47:11 AM
Sounds perfect...
To avoid any further doubt, how about

Menu > System > Lite 2.x Upgrade

Dave
Title: Re: Upgrade Script
Post by: Jerry on March 23, 2015, 10:52:25 AM
Hi Dave, I'd like to keep it consistent from LL 3.0, LL 4.0 and so on. This way people will get used to the same location, same name.
Title: Re: Upgrade Script
Post by: Wirezfree on March 23, 2015, 11:59:53 AM
No problem... Dave
Title: Re: Upgrade Script
Post by: anon222 on March 23, 2015, 01:54:30 PM
Lite Upgrade, since it's stable will be released on April the first along wilth LL 2.4?
Title: Re: Upgrade Script
Post by: Jerry on March 23, 2015, 08:56:47 PM
Lite Upgrade, since it's stable will be released on April the first along wilth LL 2.4?

I hope so :)

Sent from my GT-N7000 using Tapatalk 2