#!/bin/bash
#########################################################
#							#
# This are NScripts v3.5				#
#							#
# Licensed under the GNU GENERAL PUBLIC LICENSE 3	#
#							#
# Copyright 2007 - 2008 Christopher Bratusek		#
#							#
#########################################################

action=$(zenity --list --radiolist --title Apt --height 260 --width 420 --text "Choose an Action to perform" --column "Pick" --column "Action" TRUE "update (Update Package Database)" FALSE "upgrade (install updates (same dist))" FALSE "dist-upgrade (install updates (dist +1))" FALSE "autoclean (Clean Archive Cache)" FALSE "autoremove (Remove no longer needed packages)" FALSE "source (install source package)" FALSE "build-dep (Install Build-Dependencies for a package)")

if [[ $action == update* ]]; then
	gnome-terminal -e "su -c \"apt-get update\""
elif [[ $action == upgrade* ]]; then
	gnome-terminal -e "su -c \"apt-get upgrade\""
elif [[ $action == dist-upgrade* ]]; then
	gnome-terminal -e "su -c \"apt-get dist-upgrade\""
elif [[ $action == autoclean* ]]; then
	gnome-terminal -e "su -c \"apt-get clean\""
	gnome-terminal -e "su -c \"apt-get autoclean\""
elif [[ $action == autoremove* ]]; then
	gnome-terminal -e "su -c \"apt-get autoremove\""
elif [[ $action == source* ]]; then
	package=$(zenity --entry --title Package --text "Which package's source to install?")
	gnome-terminal -e "su -c \"apt-get source $package\""
elif [[ $action == build-dep* ]]; then
	package=$(zenity --entry --title Package --text "Which package's build dependencies to install?")
	gnome-terminal -e "su -c \"apt-get build-dep $package\""
fi
