LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upgrade Script
#25
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:
#!/bin/bash
#----------------------------------------------------------------
# Description: Linux Lite Upgrade Script
# Authors: Misko_2083, Jerry Bezencon 2015
# Website: https://www.freecinema2022.gq
#----------------------------------------------------------------

# 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
Reply


Messages In This Thread
Upgrade Script - by Valtam - 12-10-2014, 07:52 AM
Re: Upgrade Script - by sysdrum - 12-10-2014, 08:02 AM
Re: Upgrade Script - by misko_2083 - 12-12-2014, 09:57 PM
Re: Upgrade Script - by altman - 12-12-2014, 10:03 PM
Re: Upgrade Script - by misko_2083 - 12-12-2014, 10:19 PM
Re: Upgrade Script - by N4RPS - 12-22-2014, 07:55 AM
Re: Upgrade Script - by altman - 12-27-2014, 04:16 PM
Re: Upgrade Script - by Wirezfree - 01-02-2015, 11:33 AM
Re: Upgrade Script - by Valtam - 01-02-2015, 06:20 PM
Re: Upgrade Script - by Wirezfree - 01-02-2015, 06:49 PM
Re: Upgrade Script - by Valtam - 01-31-2015, 01:51 AM
Re: Upgrade Script - by Wirezfree - 01-31-2015, 09:50 AM
Re: Upgrade Script - by bitsnpcs - 01-31-2015, 03:49 PM
Re: Upgrade Script - by altman - 02-01-2015, 02:29 AM
Re: Upgrade Script - by Valtam - 02-01-2015, 04:25 AM
Re: Upgrade Script - by bitsnpcs - 02-02-2015, 11:50 PM
Re: Upgrade Script - by banko - 02-03-2015, 03:11 PM
Re: Upgrade Script - by Valtam - 02-03-2015, 05:10 PM
Re: Upgrade Script - by N4RPS - 02-05-2015, 11:30 AM
Re: Upgrade Script - by bitsnpcs - 02-05-2015, 05:46 PM
Re: Upgrade Script - by Wirezfree - 02-05-2015, 06:56 PM
Re: Upgrade Script - by Valtam - 02-06-2015, 03:06 AM
Re: Upgrade Script - by Valtam - 02-06-2015, 03:08 AM
Re: Upgrade Script - by bitsnpcs - 02-06-2015, 04:26 AM
Re: Upgrade Script - by riser - 02-06-2015, 06:04 PM
Re: Upgrade Script - by Valtam - 02-06-2015, 06:10 PM
Re: Upgrade Script - by riser - 02-06-2015, 06:35 PM
Re: Upgrade Script - by banko - 02-07-2015, 08:19 AM
Re: Upgrade Script - by N4RPS - 02-09-2015, 04:58 AM
Re: Upgrade Script - by Valtam - 02-09-2015, 11:30 AM
Re: Upgrade Script - by N4RPS - 02-10-2015, 10:39 AM
Re: Upgrade Script - by Valtam - 03-04-2015, 06:19 AM
Re: Upgrade Script - by Wirezfree - 03-04-2015, 09:49 AM
Re: Upgrade Script - by Valtam - 03-04-2015, 09:54 AM
Re: Upgrade Script - by Wirezfree - 03-04-2015, 12:14 PM
Re: Upgrade Script - by bitsnpcs - 03-04-2015, 02:41 PM
Re: Upgrade Script - by Valtam - 03-04-2015, 02:49 PM
Re: Upgrade Script - by Valtam - 03-23-2015, 11:50 AM
Re: Upgrade Script - by Wirezfree - 03-23-2015, 02:47 PM
Re: Upgrade Script - by Valtam - 03-23-2015, 02:52 PM
Re: Upgrade Script - by Wirezfree - 03-23-2015, 03:59 PM
Re: Upgrade Script - by misko_2083 - 03-23-2015, 05:54 PM
Re: Upgrade Script - by Valtam - 03-24-2015, 12:56 AM

Forum Jump:


Users browsing this thread: 12 Guest(s)