Skip to content

Commit 78d937c

Browse files
authored
Creating gui_update_1.sh file which is advanced than formar file gui_update.
This commit change the script totally.
1 parent 3395947 commit 78d937c

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

gui_update_1.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#---------------------------------------------------------------------------------------------------------------
2+
#This script update and upgrade installed packages and also removed broken packages
3+
#Building Date : 02/05/2021
4+
#Last Update : 02/05/2021
5+
#Builder : Bapon Kar
6+
#Third Party packages : zenity which can installed by 'sudo apt update -y && sudo apt install zenity -y' command
7+
#Download from : https://github.com/baponkar/gui_update.sh
8+
#License : GNU GPL v 3.0
9+
#---------------------------------------------------------------------------------------------------------------
10+
11+
12+
#!/bin/bash
13+
14+
15+
#Checking either zwnity installed or not
16+
zenity --version
17+
if [[ $? -ne 0 ]]
18+
then
19+
echo -e "Please run \'~$ sudo apt install zenity\'\n before run this script" #zenity installation command
20+
else
21+
pass=$(zenity --password --width=320 --height=150 --timeout=10 --title="GUI Update & Upgrade") #Storing password into pass variable
22+
(
23+
echo 25
24+
echo "# Updating..."
25+
echo "$pass" | sudo -S apt-get update -y 1> success.txt 2> error.txt
26+
27+
echo 30
28+
echo "# Upgrading..."
29+
echo "$pass" | sudo -S apt-get upgrade -y 1>> success.txt 2>> error.txt
30+
31+
echo 70
32+
echo "# Dist. Upgrading.."
33+
echo "$pass" | sudo -S apt-get dist-upgrade -y 1>> success.txt 2>> error.txt
34+
35+
echo 90
36+
echo "# Cleaning..."
37+
echo "$pass" | sudo -S apt-get autoclean -y 1>> success.txt 2>> error.txt
38+
39+
echo 95
40+
echo "# Removing..."
41+
echo "$pass" | sudo -S apt-get autoremove -y 1>> success.txt 2>> error.txt
42+
43+
echo 100
44+
echo "# All Done!"
45+
46+
) | zenity --title "GUI Update & Upgrade Bash script.." --progress --auto-close --auto-kill --width=320 --height=150 --title="GUI Update & Upgrade"
47+
48+
fi
49+
50+
if [[ -s error.txt ]]
51+
then
52+
zenity --text-info --filename="error.txt" --text="Error" --width=320 --height=150 --title="GUI Update & Upgrade"
53+
else
54+
zenity --info --text="The Script runs successfully!\n There is no Error!" --width=320 --height=150 --title="GUI Update & Upgrade"
55+
fi
56+
57+
rm -r error.txt
58+
rm -r success.txt

0 commit comments

Comments
 (0)