Wrote README and some additional comments and moved root-check
This commit is contained in:
parent
99c8cff113
commit
905a258562
12
README.md
Normal file
12
README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# dpkg-frontend #
|
||||
This is a simple frontend for dpkg (and apt-get) on Debian-based systems.
|
||||
I wrote it as a part of a class assignment. The script uses Zenity to display
|
||||
the GTK-dialogs and then executes diffrent commands for different things.
|
||||
Note that when installing packages, this runs `apt-get install <PKG> -y`. This
|
||||
means that all dependencies will be install without asking.
|
||||
|
||||
The script uses as few hardcoded path as possible and then finds the rest of the
|
||||
binaries with `which` and puts them variables with the same name as the binarie
|
||||
but with an uppercase initial letter.
|
||||
|
||||
|
@ -171,13 +171,6 @@ $Which $i &> /dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if we are root
|
||||
if [ $EUID -ne 0 ]; then
|
||||
$Zenity --title "dpkg-frontend" --error \
|
||||
--text "You need to run <b>dpkg-frontend</b> as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Parse command line options and arguments
|
||||
while getopts Vvho: Opt; do
|
||||
case "$Opt" in
|
||||
@ -196,10 +189,18 @@ while getopts Vvho: Opt; do
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if we are root
|
||||
if [ $EUID -ne 0 ]; then
|
||||
$Zenity --title "dpkg-frontend" --error \
|
||||
--text "You need to run <b>dpkg-frontend</b> as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
### Main ###
|
||||
search_pkg
|
||||
case $? in
|
||||
1) exit 0
|
||||
search_pkg # Start with search for a package.
|
||||
case $? in # Do different things depending on return code
|
||||
1) exit 0 # from the function search_pkg().
|
||||
;;
|
||||
5) $Zenity --title "dpkg-frontend" --question \
|
||||
--text="Package <b>$Search</b> is not installed. Install it?"
|
||||
@ -211,6 +212,8 @@ case $? in
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the package that was searched for is installed on the system
|
||||
# present different action to perform for the user.
|
||||
choice_dialog
|
||||
case $? in
|
||||
11) uninstall_pkg
|
||||
|
Loading…
x
Reference in New Issue
Block a user