3
# Options are passed on to deborphan
5
# Orphaner is a neat frontend for deborphan displaying a list
6
# of orphaned packages with dialog or whiptail. Packages may be
7
# selected for removal with apt-get which is then called to do the
8
# work. After removal a new list of orphaned packages is gathered
9
# from deborphan. The program ends when either `Cancel' is pressed
10
# or no package is marked for removal.
12
# (c) 2000 Goswin Brederlow <goswin.brederlow@student.uni-tuebingen.de>
13
# (c) 2000 Peter Palfrader <peter@palfrader.org>
15
# This program is dual licensed either unter the GNU GPL as published
16
# by the Free Software Foundation; either version 2, or (at your option)
18
# _OR_ (at your opinion)
19
# the Artistic license (under which deborphan itself is distributed).
21
# The full text of both can be found in /usr/share/common-licenses on
22
# Debian systems. If you have problems obtaining the files please
23
# write to the authors.
28
VALIDOPTIONS='^-([aDHns]|-fake-dev|-nice-mode|-all-packages|-priority(.+)|p(.+)|-show-section|-force-hold)[[:space:]]$'
29
VALIDKEEPOPTIONS='^-([aDHns]|-guess-(dev|perl|section|debug|all)|-nice-mode|-all-packages|-priority(.+)|p(.+)|-show-section|-force-hold)[[:space:]]$'
31
if [ -x /usr/bin/dialog ]; then
32
DIALOG=/usr/bin/dialog
33
elif [ -x /usr/local/bin/dialog ]; then
34
DIALOG=/usr/local/bin/dialog
35
elif [ -x /usr/bin/whiptail ]; then
36
DIALOG=/usr/bin/whiptail
37
elif [ -x /usr/local/bin/whiptail ]; then
38
DIALOG=/usr/local/bin/whiptail
40
echo "$0: You need dialog or whiptail to run this frontend." >&2
44
if echo `deborphan -h` | grep 'Do not read debfoster' >/dev/null 2>&1; then
51
echo "Usage: $0 [OPTIONS]"
53
echo "See orphaner(8) and deborphan(1) for a list of valid options."
58
for each in $OPTIONS; do
59
if [ "$SKIPONE" = "1" ]; then
61
elif [ " $each" = " --keep-file" -o " $each" = " -k" ]; then
63
elif [ " $each" = " --status-file" -o " $each" = " -f" ]; then
65
elif ! echo "$each " | egrep $VALIDKEEPOPTIONS >/dev/null; then
67
--status-file* | -f* | --keep-file* | -k*)
70
echo "$0: Invalid option: $each." >&2
77
ORPHANED=`keeping_list $OPTIONS | sort`;
78
# insert clever error handling
80
if [ "$ORPHANED" != "" ]; then
82
--backtitle "Orphaner V1.1" \
84
--title "Orphaner V1.1" \
85
--checklist "Select Packages that should never be recommended for removal in deborphan:" \
88
2>&1 >/dev/tty` || true
90
if [ ! -z "`deborphan ${nodf} -L $@`" ]; then
91
deborphan ${nodf} -L $@ | xargs deborphan -R $@
93
if [ ! -z "$PACKAGES" ]; then
94
deborphan -A $@ $PACKAGES
102
(deborphan -a $@ || echo "ERROR" ) \
103
| while read SECTION PACKAGE; do
104
echo $PACKAGE $SECTION off
106
(deborphan -L $@ 2>/dev/null|| echo "ERROR" ) \
107
| while read PACKAGE; do
114
(deborphan -s $@ || echo "ERROR") \
115
| while read SECTION PACKAGE; do
116
echo $PACKAGE $SECTION off
122
for each in $OPTIONS; do
123
if [ "$SKIPONE" = "1" ]; then
125
elif [ " $each" = " --status-file" -o " $each" = " -f" ]; then
127
elif ! echo "$each " | egrep $VALIDOPTIONS >/dev/null; then
129
--status-file* | -f*)
132
echo "$0: Invalid option: $each." >&2
140
ORPHANED=`deborphan_list $OPTIONS | sort`;
141
if [ "$ORPHANED" = "ERROR off" ] ; then
145
if [ "$ORPHANED" != "" ]; then
147
--backtitle "Orphaner V1.1" \
149
--title "Orphaner V1.1" \
150
--checklist "Select Packages for removal or cancel to quit:" \
153
2>&1 >/dev/tty` || true
157
if [ $ERROR = 0 -a "$PACKAGES" != "" ]; then
159
echo "Removing $PACKAGES..."
160
apt-get -u remove $PACKAGES
166
--backtitle "Orphaner V1.1" \
167
--title "Orphaner V1.1" \
168
--msgbox "No orphaned packages found." \
179
for each in $OPTIONS; do
180
if [ " $each" = " --help" -o " $each" = " -h" ]; then