Fixed missing indenting, vim messed it up?
This commit is contained in:
parent
91665b4f0d
commit
065795d198
120
dpkg-frontend.sh
120
dpkg-frontend.sh
@ -27,6 +27,7 @@ Author="Jack-Benny Persson (jack-benny@cyberinfo.se)"
|
|||||||
# Binaries
|
# Binaries
|
||||||
Which="/usr/bin/which"
|
Which="/usr/bin/which"
|
||||||
Aptget="/usr/bin/apt-get"
|
Aptget="/usr/bin/apt-get"
|
||||||
|
|
||||||
# Binaries entered in the list will be avalible to the script as variables with
|
# Binaries entered in the list will be avalible to the script as variables with
|
||||||
# the first letter uppercase
|
# the first letter uppercase
|
||||||
Binaries=(dpkg sed awk egrep printf cat grep mktemp rm tail zenity)
|
Binaries=(dpkg sed awk egrep printf cat grep mktemp rm tail zenity)
|
||||||
@ -63,89 +64,90 @@ EOT
|
|||||||
# Dialog for package searching
|
# Dialog for package searching
|
||||||
search_pkg()
|
search_pkg()
|
||||||
{
|
{
|
||||||
Search=`$Zenity --title "dpkg-frontend" --entry \
|
Search=`$Zenity --title "dpkg-frontend" --entry \
|
||||||
--text="Search for package"`
|
--text="Search for package"`
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
$Dpkg --list | $Awk '{ print $2 }' | $Egrep -x $Search &> /dev/null
|
|
||||||
if [ $? -eq 0 ]; then
|
$Dpkg --list | $Awk '{ print $2 }' | $Egrep -x $Search &> /dev/null
|
||||||
return 0
|
if [ $? -eq 0 ]; then
|
||||||
else
|
return 0
|
||||||
return 5
|
else
|
||||||
fi
|
return 5
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall_pkg()
|
uninstall_pkg()
|
||||||
{
|
{
|
||||||
$Zenity --title "dpkg-frontend" \
|
$Zenity --title "dpkg-frontend" \
|
||||||
--question \
|
--question \
|
||||||
--text="Package <b>$Search</b> is installed.\nUninstall <b>${Search}</b>?"
|
--text="Package <b>$Search</b> is installed.\nUninstall <b>${Search}</b>?"
|
||||||
if [ $? -eq 0 ]; then # CHANGE NEXT LINE
|
if [ $? -eq 0 ]; then # CHANGE NEXT LINE
|
||||||
$Dpkg -r $Search | $Zenity --title "dpkg-frontend" \
|
$Dpkg -r $Search | $Zenity --title "dpkg-frontend" \
|
||||||
--progress --pulsate --text "Uninstalling <b>${Search}</b>..."
|
--progress --pulsate --text "Uninstalling <b>${Search}</b>..."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_pkg()
|
install_pkg()
|
||||||
{
|
{
|
||||||
$Aptget install $Search -y | \
|
$Aptget install $Search -y | \
|
||||||
$Zenity --title "dpkg-fronend" --progress --pulsate \
|
$Zenity --title "dpkg-fronend" --progress --pulsate \
|
||||||
--text "Installing package <b>$Search</b>"
|
--text "Installing package <b>$Search</b>"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
$Zenity --title "dpkg-frontend" --info \
|
$Zenity --title "dpkg-frontend" --info \
|
||||||
--text="Succesfully installed <b>$Search</b>"
|
--text="Succesfully installed <b>$Search</b>"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
$Zenity --title "dpkg-frontend" --error \
|
$Zenity --title "dpkg-frontend" --error \
|
||||||
--text="Something went wrong with the installation of <b>$Search</b>"
|
--text="Something went wrong with the installation of <b>$Search</b>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
show_selections()
|
show_selections()
|
||||||
{
|
{
|
||||||
Selections=`dpkg --get-selections $Search | awk '{ print $2 }'`
|
Selections=`$Dpkg --get-selections $Search | awk '{ print $2 }'`
|
||||||
$Zenity --title "dpkg-frontend" \
|
$Zenity --title "dpkg-frontend" \
|
||||||
--info --text "Selections for <b>$Search</b> is: <b>${Selections}</b>"
|
--info --text "Selections for <b>$Search</b> is: <b>${Selections}</b>"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_selections()
|
set_selections()
|
||||||
{
|
{
|
||||||
SetSelections=`$Zenity --title "dpkg-frontend" --entry \
|
SetSelections=`$Zenity --title "dpkg-frontend" --entry \
|
||||||
--text="Type selections for package <b>$Search</b>"`
|
--text "Type selections for package <b>$Search</b>"`
|
||||||
echo "$Search $SetSelections" | $Dpkg --set-selections
|
echo "$Search $SetSelections" | $Dpkg --set-selections
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
$Zentiy --title "dpkg-frontend" --info \
|
$Zentiy --title "dpkg-frontend" --info \
|
||||||
--text "<b>${SetSelections}</b> is set for <b>${Search}</b>"
|
--text "<b>${SetSelections}</b> is set for <b>${Search}</b>"
|
||||||
else
|
else
|
||||||
$Zenity --title "dpkg-frontend" --error \
|
$Zenity --title "dpkg-frontend" --error \
|
||||||
--text "Couldn't set selections for <b>$Search</b>"
|
--text "Couldn't set selections for <b>$Search</b>"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
show_info()
|
show_info()
|
||||||
{
|
{
|
||||||
Info=`$Dpkg --status $Search`
|
Info=`$Dpkg --status $Search`
|
||||||
$Zenity --no-markup --title "dpkg-frontend" --info \
|
$Zenity --no-markup --title "dpkg-frontend" --info \
|
||||||
--text "$Info"
|
--text "$Info"
|
||||||
}
|
}
|
||||||
|
|
||||||
choice_dialog()
|
choice_dialog()
|
||||||
{
|
{
|
||||||
Choice=`$Zenity --list --column=Action --column=Description \
|
Choice=`$Zenity --list --column=Action --column=Description \
|
||||||
--radiolist uninstall "Uninstall" set "Set selections" \
|
--radiolist uninstall "Uninstall" set "Set selections" \
|
||||||
show "Show selections" \
|
show "Show selections" \
|
||||||
info "Show information"`
|
info "Show information"`
|
||||||
if [ "$Choice" == "Uninstall" ]; then
|
if [ "$Choice" == "Uninstall" ]; then
|
||||||
return 11
|
return 11
|
||||||
elif [ "$Choice" == "Show selections" ]; then
|
elif [ "$Choice" == "Show selections" ]; then
|
||||||
return 12
|
return 12
|
||||||
elif [ "$Choice" == "Show information" ]; then
|
elif [ "$Choice" == "Show information" ]; then
|
||||||
return 13
|
return 13
|
||||||
elif [ "$Choice" == "Set selections" ]; then
|
elif [ "$Choice" == "Set selections" ]; then
|
||||||
return 14
|
return 14
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create variables with absolute path to binaries and check
|
# Create variables with absolute path to binaries and check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user