Added some functions
This commit is contained in:
parent
1d09c57232
commit
84ee451b94
@ -60,19 +60,43 @@ print_help()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Dialog for package searching
|
# Dialog for package searching
|
||||||
search()
|
search_pkg()
|
||||||
{
|
{
|
||||||
Search=`$Zenity --title "dpkg-frontend" --entry \
|
Search=`$Zenity --title "dpkg-frontend" --entry \
|
||||||
--text="Search for package"`
|
--text="Search for package"`
|
||||||
|
|
||||||
$Dpkg --list | $Awk '{ print $2 }' | $Egrep -x $Search &> /dev/null
|
$Dpkg --list | $Awk '{ print $2 }' | $Egrep -x $Search &> /dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
Pkginfo=`$Dpkg --status $Search`
|
return 0
|
||||||
$Zenity --no-markup --title "dpkg-frontend" \
|
else
|
||||||
--info --text="$Pkginfo"
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uninstall_pkg()
|
||||||
|
{
|
||||||
|
#Pkginfo=`$Dpkg --status $Search`
|
||||||
|
$Zenity --title "dpkg-frontend" \
|
||||||
|
--question \
|
||||||
|
--text="Package $Search is installed.\nUninstall ${Search}?"
|
||||||
|
if [ $? -eq 0 ]; then # CHANGE NEXT LINE
|
||||||
|
sleep 5 | $Zenity --title "dpkg-frontend" \
|
||||||
|
--progress --pulsate --text "Uninstalling ${Search}..."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_pkg()
|
||||||
|
{
|
||||||
|
echo "Install pkg?"
|
||||||
|
}
|
||||||
|
|
||||||
|
show_selections()
|
||||||
|
{
|
||||||
|
Selections=`dpkg --get-selections $Search | awk '{ print $2 }'`
|
||||||
|
$Zenity --title "dpkg-frontend" \
|
||||||
|
--info --text "Selections for $Search is: <b>${Selections}</b>"
|
||||||
|
}
|
||||||
|
|
||||||
# Create variables with absolute path to binaries and check
|
# Create variables with absolute path to binaries and check
|
||||||
# if we can execute it (binaries will be avaliable in
|
# if we can execute it (binaries will be avaliable in
|
||||||
# variables with first character uppercase, such as Grep)
|
# variables with first character uppercase, such as Grep)
|
||||||
@ -108,7 +132,12 @@ done
|
|||||||
|
|
||||||
|
|
||||||
### Main ###
|
### Main ###
|
||||||
search
|
search_pkg
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
uninstall_pkg
|
||||||
|
fi
|
||||||
|
|
||||||
|
show_selections
|
||||||
echo $Search
|
echo $Search
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user