[Demudi-commits] r234 - in demudi/trunk: . debian
Free Ekanayaka
free-guest@haydn.debian.org
Thu, 18 Nov 2004 15:02:02 -0700
Author: free-guest
Date: 2004-11-18 15:01:55 -0700 (Thu, 18 Nov 2004)
New Revision: 234
Added:
demudi/trunk/debian/install
demudi/trunk/demudi-upgrade
Modified:
demudi/trunk/debian/changelog
Log:
demudi (0.2) unstable; urgency=low
* Added demudi-upgrade to make life easier
-- Free Ekanayaka <free@agnula.org> Tue, 16 Nov 2004 13:36:14 +0100
Modified: demudi/trunk/debian/changelog
===================================================================
--- demudi/trunk/debian/changelog 2004-11-18 21:58:39 UTC (rev 233)
+++ demudi/trunk/debian/changelog 2004-11-18 22:01:55 UTC (rev 234)
@@ -1,3 +1,9 @@
+demudi (0.2) unstable; urgency=low
+
+ * Added demudi-upgrade to make life easier
+
+ -- Free Ekanayaka <free@agnula.org> Tue, 16 Nov 2004 13:36:14 +0100
+
demudi (0.1) unstable; urgency=low
* Upgrades A/DeMuDi 1.2.0 to 1.2.1
Added: demudi/trunk/debian/install
===================================================================
--- demudi/trunk/debian/install 2004-11-18 21:58:39 UTC (rev 233)
+++ demudi/trunk/debian/install 2004-11-18 22:01:55 UTC (rev 234)
@@ -0,0 +1 @@
+demudi-upgrade usr/sbin/
Added: demudi/trunk/demudi-upgrade
===================================================================
--- demudi/trunk/demudi-upgrade 2004-11-18 21:58:39 UTC (rev 233)
+++ demudi/trunk/demudi-upgrade 2004-11-18 22:01:55 UTC (rev 234)
@@ -0,0 +1,152 @@
+#!/bin/bash
+
+set -e
+
+program="$(basename $0)"
+tmpdir="/tmp/$program"
+snapshot="2004/11/15"
+logfile="/root/demudi-upgrade.log"
+
+#
+# Start
+#
+init() {
+ mkdir -p $tmpdir/lists/partial
+ debconf-get-selections > $tmpdir/debconf_selections.bak
+}
+
+#
+# Purge
+#
+purge() {
+ debconf-set-selections $tmpdir/debconf_selections.bak
+ rm -f /etc/apt/apt.conf.d/10$program
+ rm -Rf $tmpdir/
+}
+
+#
+# APT configuration
+#
+gen_apt_preferences () {
+ cat <<EOF > $tmpdir/preferences
+Package: *
+Pin: release o=AGNULA
+Pin-Priority: 1001
+}
+
+gen_apt_sources () {
+ if /sbin/route -n | /bin/grep -q -e ^0.0.0.0; then
+
+ cat <<EOF > $tmpdir/sources.list
+deb http://apt.agnula.org/demudi testing local
+deb http://snapshot.debian.net/archive/$snapshot/debian/ testing main
+EOF
+
+ 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
+EOF
+ apt-setup $options probe -N
+ fi
+}
+
+gen_apt_conf () {
+ cat <<EOF > /etc/apt/apt.conf.d/10$program
+DPkg
+{
+ Options {"--force-confold";}
+}
+Dir
+{
+ State "$tmpdir";
+ Etc
+ {
+ sourcelist "$tmpdir/sources.list";
+ preferences "$tmpdir/preferences";
+ }
+}
+EOF
+}
+
+#
+#
+#
+abort () {
+ cat <<EOF
+!!
+!!
+!! Something wrong happened!
+!! Please send the error log to users@lists.agnula.org
+!!
+!!
+EOF
+ purge
+ exit 1
+}
+#
+# Upgrade packages
+#
+run_apt () {
+
+ cat <<EOF | debconf-set-selections
+debconf debconf/frontend select Noninteractive
+EOF
+
+ if ! apt-get update; then abort; fi
+ if ! apt-get dist-upgrade; then abort; fi
+ if ! tasksel install base; then abort; fi
+
+ exit 0
+
+}
+
+run_cfengine () {
+
+ conffiles=" \
+ /etc/default/alsa \
+ /etc/init.d/alsa \
+ /etc/vim/vimrc \
+ /etc/gdm/gdm.conf \
+ /etc/hdparm.conf \
+ "
+
+ sysfiles=" \
+ /sbin/update-grub \
+ "
+
+ for conffile in $conffiles; do # Use new versions for these
+ if [ -e "$conffile" ] && [ -e "$conffile.dpkg-dist" ]; then
+ cp $conffile $conffile.dpkg-old
+ mv $conffile.dpkg-dist $conffile
+ fi
+ done
+
+ for sysfile in $sysfiles; do # Use new versions for these
+ if [ -e "$sysfile" ] && [ -e "$sysfile.distrib" ]; then
+ cp $sysfile $sysfile.bak
+ mv $sysfile.distrib $sysfile
+ fi
+ done
+
+ demudi-cfengine all
+
+}
+
+
+2>&1
+
+trap "abort" SIGINT SIGTERM
+
+init
+gen_apt_preferences
+gen_apt_sources
+gen_apt_conf
+run_apt
+run_cfengine
+purge
Property changes on: demudi/trunk/demudi-upgrade
___________________________________________________________________
Name: svn:executable
+ *