Skip to content

Instantly share code, notes, and snippets.

@fsmithred
Created March 31, 2013 13:51
Show Gist options
  • Save fsmithred/5280647 to your computer and use it in GitHub Desktop.
Save fsmithred/5280647 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
version="repsit_2013mar31"
# copyright 2011 fsmithred@gmail.com
# License: GPL-3
# Refracta Extra Package Selection and Installation Tool (repsit)
# define some package lists.
#
# If you add a package list here, you must also add it to the
# zenity lists for installing and removing packages, and to the corresponding
# if/then list below each. Note that a list can contain one or more packages.
deja_dup=(deja-dup)
mc=(mc mc-data)
gdmap=(gdmap)
tilda=(tilda)
gimp=(gimp gimp-data)
xsane=(xsane xsane-common)
evince=(evince evince-common)
gftp=(gftp gftp-common)
transmission=(transmission-gtk transmission transmission-common)
zenmap=(zenmap)
xchat=(xchat xchat-common)
vnc=(x11vnc libvncserver0 xtightvncviewer)
asunder=(asunder)
brasero=(brasero brasero-common)
gnome_mplayer=(gnome-mplayer gecko-mediaplayer)
winff=(winff)
alsamixergui=(alsamixergui)
abiword=(abiword abiword-common)
gnumeric=(gnumeric gnumeric-common)
galternatives=(galternatives)
bleachbit=(bleachbit)
gdebi=(gdebi)
gkdebconf=(gkdebconf)
htop=(htop)
hardinfo=(hardinfo)
gnome_system_tools=(gnome-system-tools system-tools-backends)
clamav=(clamav clamav-freshclam libclamav6)
xscreensaver=(xscreensaver-data xscreensaver)
virtualbox=(virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11)
cups=(cups-common cups-bsd cups-client cups-ppdc cups-filters cups)
gthumb=(gthumb-data gthumb)
# Long function to install package groups
install_packages () {
ans=$(zenity --list --title="Installation Menu" --text "Choose package groups to install. This list contains a few common package groups and some preferred software.
To see all available software, install and use Synaptic, or use command-line tools (aptitude, apt-get, apt-cache, apt-file.)
" --checklist \
--ok-label=OK --cancel-label=Cancel --width=520 --height=360 \
--column "Pick" --column "Package Group" --column "Description" \
FALSE abiword "efficient, featureful word processor " \
FALSE alsamixergui "graphical soundcard mixer " \
FALSE asunder "graphical audio CD ripper and encoder " \
FALSE bleachbit "delete unnecessary files from the system " \
FALSE brasero "CD/DVD burning application for GNOME " \
FALSE clamav "anti-virus utility for Unix " \
FALSE cups "Common UNIX Printing System " \
FALSE deja_dup "Backup utility " \
FALSE evince "Document (PostScript, PDF) viewer " \
FALSE galternatives "graphical setup tool for the alternatives system " \
FALSE gdebi "simple tool to install deb files " \
FALSE gdmap "Tool to visualize diskspace " \
FALSE gftp "X/GTK+ and console FTP client " \
FALSE gimp "The GNU Image Manipulation Program " \
FALSE gkdebconf "Helper to reconfigure packages with Debconf " \
FALSE gnome_mplayer "GTK+ interface for MPlayer " \
FALSE gnome_system_tools "Cross-platform configuration utilities for GNOME " \
FALSE gnumeric "spreadsheet application for GNOME " \
FALSE gthumb "image viewer and browser " \
FALSE hardinfo "Displays system information " \
FALSE htop "interactive processes viewer " \
FALSE mc "Midnight Commander - a powerful file manager " \
FALSE tilda "terminal emulator with first person shooter console likeness " \
FALSE transmission "lightweight BitTorrent client " \
FALSE virtualbox "x86 virtualization solution " \
FALSE vnc "Virtual network computing software " \
FALSE winff "graphical video and audio batch converter using ffmpeg " \
FALSE xchat "IRC client for X similar to AmIRC " \
FALSE xsane "featureful graphical frontend for SANE " \
FALSE xscreensaver "Automatic screensaver for X " \
FALSE zenmap "The Network Mapper Front End " )
echo "$ans"
# this needs to be here in case the list is cancelled or ok'd with no selections.
if [[ -z $ans ]]; then
choose_task
return
fi
# Put all selected package lists into an install list.
if $(echo $ans | grep -q deja_dup) ; then
install_list=("${install_list[@]}" "${deja_dup[@]}")
fi
if $(echo $ans | grep -q mc) ; then
install_list=("${install_list[@]}" "${mc[@]}")
fi
if $(echo $ans | grep -q gdmap) ; then
install_list=("${install_list[@]}" "${gdmap[@]}")
fi
if $(echo $ans | grep -q tilda) ; then
install_list=("${install_list[@]}" "${tilda[@]}")
fi
if $(echo $ans | grep -q gimp) ; then
install_list=("${install_list[@]}" "${gimp[@]}")
fi
if $(echo $ans | grep -q xsane) ; then
install_list=("${install_list[@]}" "${xsane[@]}")
fi
if $(echo $ans | grep -q evince) ; then
install_list=("${install_list[@]}" "${evince[@]}")
fi
if $(echo $ans | grep -q gftp) ; then
install_list=("${install_list[@]}" "${gftp[@]}")
fi
if $(echo $ans | grep -q transmission) ; then
install_list=("${install_list[@]}" "${transmission[@]}")
fi
if $(echo $ans | grep -q zenmap) ; then
install_list=("${install_list[@]}" "${zenmap[@]}")
fi
if $(echo $ans | grep -q xchat) ; then
install_list=("${install_list[@]}" "${xchat[@]}")
fi
if $(echo $ans | grep -q vnc) ; then
install_list=("${install_list[@]}" "${vnc[@]}")
fi
if $(echo $ans | grep -q asunder) ; then
install_list=("${install_list[@]}" "${asunder[@]}")
fi
if $(echo $ans | grep -q brasero) ; then
install_list=("${install_list[@]}" "${brasero[@]}")
fi
if $(echo $ans | grep -q gnome_mplayer) ; then
install_list=("${install_list[@]}" "${gnome_mplayer[@]}")
fi
if $(echo $ans | grep -q winff) ; then
install_list=("${install_list[@]}" "${winff[@]}")
fi
if $(echo $ans | grep -q alsamixergui) ; then
install_list=("${install_list[@]}" "${alsamixergui[@]}")
fi
if $(echo $ans | grep -q abiword) ; then
install_list=("${install_list[@]}" "${abiword[@]}")
fi
if $(echo $ans | grep -q gnumeric) ; then
install_list=("${install_list[@]}" "${gnumeric[@]}")
fi
if $(echo $ans | grep -q galternatives) ; then
install_list=("${install_list[@]}" "${galternatives[@]}")
fi
if $(echo $ans | grep -q bleachbit) ; then
install_list=("${install_list[@]}" "${bleachbit[@]}")
fi
if $(echo $ans | grep -q gdebi) ; then
install_list=("${install_list[@]}" "${gdebi[@]}")
fi
if $(echo $ans | grep -q gkdebconf) ; then
install_list=("${install_list[@]}" "${gkdebconf[@]}")
fi
if $(echo $ans | grep -q htop) ; then
install_list=("${install_list[@]}" "${htop[@]}")
fi
if $(echo $ans | grep -q hardinfo) ; then
install_list=("${install_list[@]}" "${hardinfo[@]}")
fi
if $(echo $ans | grep -q gnome_system_tools) ; then
install_list=("${install_list[@]}" "${gnome_system_tools[@]}")
fi
if $(echo $ans | grep -q clamav) ; then
install_list=("${install_list[@]}" "${clamav[@]}")
fi
if $(echo $ans | grep -q xscreensaver) ; then
install_list=("${install_list[@]}" "${xscreensaver[@]}")
fi
if $(echo $ans | grep -q virtualbox) ; then
install_list=("${install_list[@]}" "${virtualbox[@]}")
fi
if $(echo $ans | grep -q cups) ; then
install_list=("${install_list[@]}" "${cups[@]}")
fi
if $(echo $ans | grep -q gthumb) ; then
install_list=("${install_list[@]}" "${gthumb[@]}")
fi
echo "${install_list[@]}"
zenity --question --text="$(aptitude -s install ${install_list[@]} &)"
if [[ $? = 0 ]] ; then
aptitude -y install ${install_list[@]} | tee >(zenity --progress --pulsate)
kill $(pgrep zenity)
fi
choose_task
}
# Long function to remove (purge) package groups
remove_packages () {
ans=$(zenity --list --title="Uninstall Menu" --text "Choose package groups to remove/purge.
" --checklist \
--ok-label=OK --cancel-label=Cancel --width=520 --height=360 \
--column "Pick" --column "Package Group" --column "Description" \
FALSE abiword "efficient, featureful word processor " \
FALSE alsamixergui "graphical soundcard mixer " \
FALSE asunder "graphical audio CD ripper and encoder " \
FALSE bleachbit "delete unnecessary files from the system " \
FALSE brasero "CD/DVD burning application for GNOME " \
FALSE clamav "anti-virus utility for Unix " \
FALSE cups "Common UNIX Printing System " \
FALSE deja_dup "Backup utility " \
FALSE evince "Document (PostScript, PDF) viewer " \
FALSE galternatives "graphical setup tool for the alternatives system " \
FALSE gdebi "simple tool to install deb files " \
FALSE gdmap "Tool to visualize diskspace " \
FALSE gftp "X/GTK+ and console FTP client " \
FALSE gimp "The GNU Image Manipulation Program " \
FALSE gkdebconf "Helper to reconfigure packages with Debconf " \
FALSE gnome_mplayer "GTK+ interface for MPlayer " \
FALSE gnome_system_tools "Cross-platform configuration utilities for GNOME " \
FALSE gnumeric "spreadsheet application for GNOME " \
FALSE gthumb "image viewer and browser " \
FALSE hardinfo "Displays system information " \
FALSE htop "interactive processes viewer " \
FALSE mc "Midnight Commander - a powerful file manager " \
FALSE tilda "terminal emulator with first person shooter console likeness " \
FALSE transmission "lightweight BitTorrent client " \
FALSE virtualbox "x86 virtualization solution " \
FALSE vnc "Virtual network computing software " \
FALSE winff "graphical video and audio batch converter using ffmpeg " \
FALSE xchat "IRC client for X similar to AmIRC " \
FALSE xsane "featureful graphical frontend for SANE " \
FALSE xscreensaver "Automatic screensaver for X " \
FALSE zenmap "The Network Mapper Front End " )
echo "$ans"
# this needs to be here in case the list is cancelled or ok'd with no selections.
if [[ -z $ans ]]; then
choose_task
return
fi
# Put all selected package lists into an install list.
if $(echo $ans | grep -q deja_dup) ; then
remove_list=("${remove_list[@]}" "${deja_dup[@]}")
fi
if $(echo $ans | grep -q mc) ; then
remove_list=("${remove_list[@]}" "${mc[@]}")
fi
if $(echo $ans | grep -q gdmap) ; then
remove_list=("${remove_list[@]}" "${gdmap[@]}")
fi
if $(echo $ans | grep -q tilda) ; then
remove_list=("${remove_list[@]}" "${tilda[@]}")
fi
if $(echo $ans | grep -q gimp) ; then
remove_list=("${remove_list[@]}" "${gimp[@]}")
fi
if $(echo $ans | grep -q xsane) ; then
remove_list=("${remove_list[@]}" "${xsane[@]}")
fi
if $(echo $ans | grep -q evince) ; then
remove_list=("${remove_list[@]}" "${evince[@]}")
fi
if $(echo $ans | grep -q gftp) ; then
remove_list=("${remove_list[@]}" "${gftp[@]}")
fi
if $(echo $ans | grep -q transmission) ; then
remove_list=("${remove_list[@]}" "${transmission[@]}")
fi
if $(echo $ans | grep -q zenmap) ; then
remove_list=("${remove_list[@]}" "${zenmap[@]}")
fi
if $(echo $ans | grep -q xchat) ; then
remove_list=("${remove_list[@]}" "${xchat[@]}")
fi
if $(echo $ans | grep -q vnc) ; then
remove_list=("${remove_list[@]}" "${vnc[@]}")
fi
if $(echo $ans | grep -q asunder) ; then
remove_list=("${remove_list[@]}" "${asunder[@]}")
fi
if $(echo $ans | grep -q brasero) ; then
remove_list=("${remove_list[@]}" "${brasero[@]}")
fi
if $(echo $ans | grep -q gnome_mplayer) ; then
remove_list=("${remove_list[@]}" "${gnome_mplayer[@]}")
fi
if $(echo $ans | grep -q winff) ; then
remove_list=("${remove_list[@]}" "${winff[@]}")
fi
if $(echo $ans | grep -q alsamixergui) ; then
remove_list=("${remove_list[@]}" "${alsamixergui[@]}")
fi
if $(echo $ans | grep -q abiword) ; then
remove_list=("${remove_list[@]}" "${abiword[@]}")
fi
if $(echo $ans | grep -q gnumeric) ; then
remove_list=("${remove_list[@]}" "${gnumeric[@]}")
fi
if $(echo $ans | grep -q galternatives) ; then
remove_list=("${remove_list[@]}" "${galternatives[@]}")
fi
if $(echo $ans | grep -q bleachbit) ; then
remove_list=("${remove_list[@]}" "${bleachbit[@]}")
fi
if $(echo $ans | grep -q gdebi) ; then
remove_list=("${remove_list[@]}" "${gdebi[@]}")
fi
if $(echo $ans | grep -q gkdebconf) ; then
remove_list=("${remove_list[@]}" "${gkdebconf[@]}")
fi
if $(echo $ans | grep -q htop) ; then
remove_list=("${remove_list[@]}" "${htop[@]}")
fi
if $(echo $ans | grep -q hardinfo) ; then
remove_list=("${remove_list[@]}" "${hardinfo[@]}")
fi
if $(echo $ans | grep -q gnome_system_tools) ; then
remove_list=("${remove_list[@]}" "${gnome_system_tools[@]}")
fi
if $(echo $ans | grep -q clamav) ; then
remove_list=("${remove_list[@]}" "${clamav[@]}")
fi
if $(echo $ans | grep -q xscreensaver) ; then
remove_list=("${remove_list[@]}" "${xscreensaver[@]}")
fi
if $(echo $ans | grep -q virtualbox) ; then
remove_list=("${remove_list[@]}" "${virtualbox[@]}")
fi
if $(echo $ans | grep -q cups) ; then
remove_list=("${remove_list[@]}" "${cups[@]}")
fi
if $(echo $ans | grep -q gthumb) ; then
remove_list=("${remove_list[@]}" "${gthumb[@]}")
fi
echo "${remove_list[@]}"
zenity --question --text="$(aptitude -s purge ${remove_list[@]} &)"
if [[ $? = 0 ]] ; then
aptitude -y purge ${remove_list[@]} | tee >(zenity --progress --pulsate)
kill $(pgrep zenity)
fi
choose_task
}
check_status () {
ans=$(zenity --list --title="Installation Status" --text " Check the installation status of selected packages.
" --checklist \
--ok-label=OK --cancel-label=Cancel --width=520 --height=360 \
--column "Pick" --column "Package Group" --column "Description" \
--separator " " \
FALSE abiword "efficient, featureful word processor " \
FALSE alsamixergui "graphical soundcard mixer " \
FALSE asunder "graphical audio CD ripper and encoder " \
FALSE bleachbit "delete unnecessary files from the system " \
FALSE brasero "CD/DVD burning application for GNOME " \
FALSE clamav "anti-virus utility for Unix " \
FALSE cups "Common UNIX Printing System " \
FALSE deja_dup "Backup utility " \
FALSE evince "Document (PostScript, PDF) viewer " \
FALSE galternatives "graphical setup tool for the alternatives system " \
FALSE gdebi "simple tool to install deb files " \
FALSE gdmap "Tool to visualize diskspace " \
FALSE gftp "X/GTK+ and console FTP client " \
FALSE gimp "The GNU Image Manipulation Program " \
FALSE gkdebconf "Helper to reconfigure packages with Debconf " \
FALSE gnome_mplayer "GTK+ interface for MPlayer " \
FALSE gnome_system_tools "Cross-platform configuration utilities for GNOME " \
FALSE gnumeric "spreadsheet application for GNOME " \
FALSE gthumb "image viewer and browser " \
FALSE hardinfo "Displays system information " \
FALSE htop "interactive processes viewer " \
FALSE mc "Midnight Commander - a powerful file manager " \
FALSE tilda "terminal emulator with first person shooter console likeness " \
FALSE transmission "lightweight BitTorrent client " \
FALSE virtualbox "x86 virtualization solution " \
FALSE vnc "Virtual network computing software " \
FALSE winff "graphical video and audio batch converter using ffmpeg " \
FALSE xchat "IRC client for X similar to AmIRC " \
FALSE xsane "featureful graphical frontend for SANE " \
FALSE xscreensaver "Automatic screensaver for X " \
FALSE zenmap "The Network Mapper Front End " )
echo "$ans"
# this needs to be here in case the list is cancelled or ok'd with no selections.
if [[ -z $ans ]]; then
choose_task
return
fi
# Put all selected package lists into an install list.
if $(echo $ans | grep -q deja_dup) ; then
query_list=("${query_list[@]}" "${deja_dup[@]}")
fi
if $(echo $ans | grep -q mc) ; then
query_list=("${query_list[@]}" "${mc[@]}")
fi
if $(echo $ans | grep -q gdmap) ; then
query_list=("${query_list[@]}" "${gdmap[@]}")
fi
if $(echo $ans | grep -q tilda) ; then
query_list=("${query_list[@]}" "${tilda[@]}")
fi
if $(echo $ans | grep -q gimp) ; then
query_list=("${query_list[@]}" "${gimp[@]}")
fi
if $(echo $ans | grep -q xsane) ; then
query_list=("${query_list[@]}" "${xsane[@]}")
fi
if $(echo $ans | grep -q evince) ; then
query_list=("${query_list[@]}" "${evince[@]}")
fi
if $(echo $ans | grep -q gftp) ; then
query_list=("${query_list[@]}" "${gftp[@]}")
fi
if $(echo $ans | grep -q transmission) ; then
query_list=("${query_list[@]}" "${transmission[@]}")
fi
if $(echo $ans | grep -q zenmap) ; then
query_list=("${query_list[@]}" "${zenmap[@]}")
fi
if $(echo $ans | grep -q xchat) ; then
query_list=("${query_list[@]}" "${xchat[@]}")
fi
if $(echo $ans | grep -q vnc) ; then
query_list=("${query_list[@]}" "${vnc[@]}")
fi
if $(echo $ans | grep -q asunder) ; then
query_list=("${query_list[@]}" "${asunder[@]}")
fi
if $(echo $ans | grep -q brasero) ; then
query_list=("${query_list[@]}" "${brasero[@]}")
fi
if $(echo $ans | grep -q gnome_mplayer) ; then
query_list=("${query_list[@]}" "${gnome_mplayer[@]}")
fi
if $(echo $ans | grep -q winff) ; then
query_list=("${query_list[@]}" "${winff[@]}")
fi
if $(echo $ans | grep -q alsamixergui) ; then
query_list=("${query_list[@]}" "${alsamixergui[@]}")
fi
if $(echo $ans | grep -q abiword) ; then
query_list=("${query_list[@]}" "${abiword[@]}")
fi
if $(echo $ans | grep -q gnumeric) ; then
query_list=("${query_list[@]}" "${gnumeric[@]}")
fi
if $(echo $ans | grep -q galternatives) ; then
query_list=("${query_list[@]}" "${galternatives[@]}")
fi
if $(echo $ans | grep -q bleachbit) ; then
query_list=("${query_list[@]}" "${bleachbit[@]}")
fi
if $(echo $ans | grep -q gdebi) ; then
query_list=("${query_list[@]}" "${gdebi[@]}")
fi
if $(echo $ans | grep -q gkdebconf) ; then
query_list=("${query_list[@]}" "${gkdebconf[@]}")
fi
if $(echo $ans | grep -q htop) ; then
query_list=("${query_list[@]}" "${htop[@]}")
fi
if $(echo $ans | grep -q hardinfo) ; then
query_list=("${query_list[@]}" "${hardinfo[@]}")
fi
if $(echo $ans | grep -q gnome_system_tools) ; then
query_list=("${query_list[@]}" "${gnome_system_tools[@]}")
fi
if $(echo $ans | grep -q clamav) ; then
query_list=("${query_list[@]}" "${clamav[@]}")
fi
if $(echo $ans | grep -q xscreensaver) ; then
query_list=("${query_list[@]}" "${xscreensaver[@]}")
fi
if $(echo $ans | grep -q virtualbox) ; then
query_list=("${query_list[@]}" "${virtualbox[@]}")
fi
if $(echo $ans | grep -q cups) ; then
query_list=("${query_list[@]}" "${cups[@]}")
fi
if $(echo $ans | grep -q gthumb) ; then
query_list=("${query_list[@]}" "${gthumb[@]}")
fi
echo "here's the list: ${query_list[@]}"
if [[ -f status_list.tmp ]] ; then
rm status_list.tmp
fi
for i in $(echo ${query_list[@]}) ; do
if dpkg -l | grep "$i" ; then
echo "$i is installed" >> status_list.tmp
else
echo "$i is NOT installed" >> status_list.tmp
fi
done
cat status_list.tmp | zenity --text-info
rm status_list.tmp
choose_task
}
remove_unused_configs () {
ctext=$(aptitude search ~c)
if [[ -z $ctext ]] ; then
ctext="There are no unused config files.
Press CANCEL"
fi
zenity --question --text="$ctext" --ok-label=OK --cancel-label=Cancel --title="Remove unused configs?"
if [[ $? = 0 ]] ; then
aptitude -y purge ~c | tee >(zenity --progress --pulsate)
kill $(pgrep zenity)
fi
choose_task
}
# Choose update, install, remove software or check installation status
choose_task () {
run_task=$(zenity --list --title="$version" \
--ok-label=OK --cancel-label=Exit --width=320 --height=305 --radiolist \
--text="Before installing new software, the system should be updated. If you
haven't done this recently (i.e. in the last 24 hours) you should run the update now.
Otherwise, you can choose to install or remove software or check the
status of a package.
Click OK to proceed, or Cancel to exit the program." \
--column "Choose Task" --column "Description" \
TRUE update \
FALSE install_software \
FALSE remove_software \
FALSE check_status \
FALSE remove_unused_configs)
if $(echo $run_task | grep -q install_software) ; then
install_packages
fi
if $(echo $run_task | grep -q remove_software) ; then
remove_packages
fi
if $(echo $run_task | grep -q update) ; then
aptitude update | tee >(zenity --progress --pulsate)
kill $(pgrep zenity)
choose_task
fi
if $(echo $run_task | grep -q check_status) ; then
check_status
fi
if $(echo $run_task | grep -q remove_unused_configs) ; then
remove_unused_configs
fi
}
#
# The action starts here...
#
# Check that user is root.
[[ $(id -u) -eq 0 ]] || { printf "\t You need to be root!\n" ; exit 1 ; }
choose_task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment