[Demudi-commits] r266 - in demudi/trunk: . debian
Free Ekanayaka
free-guest@haydn.debian.org
Thu, 25 Nov 2004 05:45:48 -0700
Author: free-guest
Date: 2004-11-25 05:45:38 -0700 (Thu, 25 Nov 2004)
New Revision: 266
Modified:
demudi/trunk/debian/changelog
demudi/trunk/demudi-upgrade
Log:
* Removing tmp directory
* Generating APT conf files *before* running apt-setup
* Skip loggin apt-set
Modified: demudi/trunk/debian/changelog
===================================================================
--- demudi/trunk/debian/changelog 2004-11-25 08:47:37 UTC (rev 265)
+++ demudi/trunk/debian/changelog 2004-11-25 12:45:38 UTC (rev 266)
@@ -1,3 +1,11 @@
+demudi (0.4) unstable; urgency=low
+
+ * Removing tmp directory
+ * Generating APT conf files *before* running apt-setup
+ * Skip loggin apt-set
+
+ -- Free Ekanayaka <free@agnula.org> Fri, 19 Nov 2004 13:04:17 +0100
+
demudi (0.3) unstable; urgency=low
* Added logging facility to the upgrade scripts, helps reports.
Modified: demudi/trunk/demudi-upgrade
===================================================================
--- demudi/trunk/demudi-upgrade 2004-11-25 08:47:37 UTC (rev 265)
+++ demudi/trunk/demudi-upgrade 2004-11-25 12:45:38 UTC (rev 266)
@@ -2,27 +2,59 @@
set -e
+logging=false
+network=false
+second=false
+quiet=
program="$(basename $0)"
tmpdir="/tmp/$program"
snapshot="2004/11/15"
logfile="/root/demudi-upgrade.log"
-quiet=""
+author="Free Ekanayaka <free@agnula.org>"
#
+# How to use me
+#
+usage() {
+ cat << EOF
+Usage: $program [OPTION] ...
+Upgrades an A/DeMuDi installation.
+
+ -n network upgrade
+ -l log output to $logfile
+ -h show this message
+
+Report bugs to $author
+EOF
+ exit 1
+}
+
+#
# Start
#
-init() {
- mkdir -p $tmpdir/lists/partial
- debconf-get-selections > $tmpdir/debconf_selections.bak
+parse () {
+ while getopts ":lnhs" Option
+ do
+ case $Option in
+ l ) logging=true;;
+ n ) network=true; quiet=-q;;
+ s ) second=true;;
+ h ) usage;;
+ * ) echo "$program: invalid option -- $Option"; echo "Try \'$program -h\' for more information"; exit 1;;
+ esac
+ done
}
#
# Purge
#
purge() {
- debconf-set-selections $tmpdir/debconf_selections.bak
+ cat <<EOF | debconf-set-selections
+debconf debconf/priority select medium
+debconf debconf/frontend select Dialog
+EOF
rm -f /etc/apt/apt.conf.d/10$program
-# rm -Rf $tmpdir/
+ rm -Rf $tmpdir/
}
#
@@ -37,7 +69,7 @@
}
gen_apt_sources () {
- if /sbin/route -n | /bin/grep -q -e ^0.0.0.0; then
+ if [ $network == true ]; then
cat <<EOF > $tmpdir/sources.list
deb http://apt.agnula.org/demudi testing local
@@ -47,14 +79,16 @@
else
cat <<EOF | debconf-set-selections
-base-config apt-setup/security-updates boolean false
-base-config apt-setup/another boolean false
-base-config apt-setup/non-free boolean false
-base-config apt-setup/contrib boolean false
-debconf debconf/priority select high
-debconf debconf/frontend select Dialog
+base-config apt-setup/uri_type select cdrom
+base-config apt-setup/security-updates boolean false
+base-config apt-setup/security-updates boolean false
+base-config apt-setup/another boolean false
+base-config apt-setup/non-free boolean false
+base-config apt-setup/contrib boolean false
+debconf debconf/priority select high
+debconf debconf/frontend select Dialog
EOF
- apt-setup $options probe -N
+ apt-setup probe -N
fi
}
@@ -90,24 +124,25 @@
!!
!!
EOF
- purge
exit 1
}
+
#
# Upgrade packages
#
run_apt () {
-
cat <<EOF | debconf-set-selections
-debconf debconf/frontend select Noninteractive
+debconf debconf/frontend select Noninteractive
EOF
+ if ! apt-get update $quiet; then abort; fi
- if ! apt-get update $quiet ; then abort; fi
+ base=$(tasksel --task-packages base)
+ kernel=kernel-image-$(uname -r|cut -d - -f 1|cut -d . -f 1-2)-$(uname -r|cut -d - -f 4) \
+ alsa=alsa-modules-$(apt-cache depends $kernel | tail -1| cut -f 3- -d -)
+ extra="$base $kernel $alsa"
- extra=$(tasksel --task-packages base)
-
- if ! apt-get dist-upgrade $quiet ; then abort; fi
+ if ! apt-get dist-upgrade $quiet; then abort; fi
if ! apt-get install -y $quiet $extra; then abort; fi
}
@@ -144,21 +179,24 @@
}
-trap "abort" SIGINT SIGTERM
+trap "purge" EXIT
+#ERR SIGINT SIGTERM
-if [ "$1" == "log" ]; then
- $0 quiet 2>&1 | tee $logfile
- exit
+parse $@
+
+if ! [ -d $tmpdir ]; then
+ mkdir -p $tmpdir/lists/partial
+ gen_apt_preferences
+ gen_apt_conf
+ gen_apt_sources
fi
-if [ "$1" == "quiet" ]; then
- quiet="-q"
+if [ $logging == true ] && [ $second == false ]; then
+ $0 $@ -s 2>&1 | tee $logfile
+ exit
fi
-init
-gen_apt_preferences
-gen_apt_sources
-gen_apt_conf
run_apt
run_cfengine
-purge
+
+exit