File: upgrade-system

package info (click to toggle)
upgrade-system 1.0.1.5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 100 kB
  • sloc: sh: 105; makefile: 5
file content (95 lines) | stat: -rwxr-xr-x 2,205 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh
#
## UPDATE-SYSTEM  -  simple Debian system updater.
#  
## HOMEPAGE
#  http://funkyware.konflux.at/
#
## AUTHORS 
#  Christoph Schindler <hop@30hopsmax.at> (2004)
#  Martin-Eric Racine <q-funk@iki.fi> (2004,2005)
#  Martin Zdrahal <martin.zdrahal@konflux.at> (2003)
#
## CHANGES
#  2005-12-04   Use APT instead of DPKG purge.	v1.0 [MER]
#  2005-05-29   Add non-interactive detection.	v0.9 [MER]
#  2004-09-04   Make orphan purge recursive.	v0.8 [CS]
#  2004-08-19   Add APT exit code check.	v0.7 [MER]
#  2004-06-07   Add CLEANOPTS to config.	v0.6 [MER]
#  2004-03-31   Create config file.		v0.5 [MER]
#  2004-03-24   Add -y to dist-upgrade.		v0.4 [MER]
#  2004-03-15   Add --guess-doc --libdevel.	v0.3 [MER]
#  2004-03-09   Rename upgrade-system.		v0.2 [MER]
#  2004-02-16   Initial release.		v0.1 [MZ]
#
. /etc/upgrade-system.conf
tty -s
if [ $? != 0 ]
then
	echo "N: Non-Interactive upgrade selected."
	NOTTY="-q -y -o DPkg::Options::=--force-confdef"
	DEBIAN_FRONTEND="noninteractive"
	export DEBIAN_FRONTEND
	#DEBCONF_ADMIN_EMAIL=""
	#export DEBCONF_ADMIN_EMAIL
fi
echo "1) Updating available package lists."
apt-get -q=2 update
if [ $? != 0 ]
then
	echo "E: Some package lists could not be updated."
	exit 1
fi
echo "2) Upgrading installed packages:"
apt-get $NOTTY -u $UPGRADEOPTS
if [ $? != 0 ]
then
	echo "E: Some packages could not be upgraded."
	exit 2
fi
echo "3) Cleaning APT cache."
apt-get $CLEANOPTS
echo "4) Checking for orphan packages:"
while /bin/true
do
	ORPHANS=$( deborphan $ORPHANOPTS )
	case $ORPHANS in
		"")
			echo "I: No orphan package to be purged."
			break
			;;
		*)
			echo "I: Purging orphan packages..."
			apt-get $NOTTY --purge remove $ORPHANS
			# escape dangerous purges automatically 
			if [ $? != 0 ]
			then
			        break
			fi
			;;
	esac
done
case $FLAUSCH in
	"")
		break
		;;
	*)
		echo "[] Checking for orphan configurations:" 
		while /bin/true
		do
			ORPHANS=$( deborphan --find-config )
			case $ORPHANS in
				"")
					echo "I: No orphan configuration to be purged."
					break
					;;
				*)
					echo "I: Purging orphan configurations..."
					dpkg -P $ORPHANS
					;;
			esac
		done
		;;
esac
echo "N: System upgrade completed."
#EOF