[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#672523: please include "preserve /home" functionality



Le Sat, May 12, 2012 at 08:08:12AM +0200, Christian PERRIER a écrit :
> > 
> > For example, if you need to upgrade laptops that have rather small (thus 
> > only a swap+root partition setup) and full harddisks to the next release.
> > (Especially if you will also need to change the desktop environment,
> > to maintain the uability. Then you can get rid of the old DE by only installing 
> > the new one.)
> > 
> > The "preserve /home" functionallity has been used with ubuntu for
> > quite some time now.
> > 
> > The spec can be found here:
> > https://wiki.ubuntu.com/UbiquityPreserveHome
> > 
> > And this even seems to suggest there might already exist debian-installer patches:
> > https://wiki.edubuntu.org/komputes/HowToDebianInstallerPreserveHome
> 
> I don't really see where this page suggests this. It gives a step by
> step method, using the "manual partitioning" method....which I think
> is logical for such purpose.
> 
> This is already possible with the current installer and there's
> nothing to change. What exactly would you like to see changed?

Hi all,

I have the impression that this function was intrduced in the following revision.

  http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/quantal/partman-target/quantal/revision/18

I attached the corresponding diff.

Have a nice day,

-- 
Charles
=== added directory 'commit.d'
=== added file 'commit.d/_numbers'
--- commit.d/_numbers	1970-01-01 00:00:00 +0000
+++ commit.d/_numbers	2008-01-22 16:06:55 +0000
@@ -0,0 +1,1 @@
+60 clear_partitions

=== added file 'commit.d/clear_partitions'
--- commit.d/clear_partitions	1970-01-01 00:00:00 +0000
+++ commit.d/clear_partitions	2008-01-22 16:06:55 +0000
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Remove critical files to ensure we don't end up with a mixed system.
+
+. /lib/partman/lib/base.sh
+
+failed () {
+    db_progress STOP
+    db_input critical partman-target/clear_partitions_failed || true
+    db_go || true
+    exit 1
+}
+
+partitions=$(
+for dev in $DEVICES/*; do
+    [ -d "$dev" ] || continue
+    cd $dev
+    open_dialog PARTITIONS
+    while { read_line num id size type fs path name; [ "$id" ]; }; do
+	[ "$fs" != free ] || continue
+	[ -f "$id/mountpoint" ] || continue
+	[ -f "$id/format" ] && continue
+	mp="$(cat "$id/mountpoint")"
+	echo "$mp,$path"
+    done
+    close_dialog
+done | sort
+)
+
+[ -n "$partitions" ] || exit 0
+
+tmp="/mnt/tmpmount"
+mkdir -p $tmp
+for part in $partitions; do
+    mp="${part%,*}"
+    path="${part#*,}"
+    mount $path $tmp$mp || failed
+done
+
+template=partman-target/clear_partitions_progress
+db_progress START 0 12 ubiquity/install/title
+db_progress INFO $template
+for x in bin boot dev etc lib lib32 lib64 proc sbin usr var sys; do
+    db_progress STEP 1
+    [ -e $tmp/$x ] && (rm -rf $tmp/$x || failed)
+done
+for x in $tmp/initrd* $tmp/vmlinuz*; do
+    [ -e $x ] && (rm -rf $x || failed)
+done
+
+# /home could be a symlink.
+[ -f $tmp/home ] && (rm $tmp/home || failed)
+db_progress STOP
+
+# Preserve the UID, if possible.
+db_get passwd/username || true
+username=$RET
+if [ -n $username ] && [ -d $tmp/home/$username ]; then
+    db_set passwd/user-uid "$(stat -c %u $tmp/home/$username)" || true
+    db_set passwd/user-gid "$(stat -c %g $tmp/home/$username)" || true
+fi
+
+partitions=$(
+for part in $partitions; do
+    echo "$part"
+done | sort -r
+)
+
+for part in $partitions; do
+    mp="${part%,*}"
+    path="${part#*,}"
+    umount $path || failed
+done
+
+rmdir $tmp || failed

=== modified file 'debian/changelog'
--- debian/changelog	2007-10-23 17:53:53 +0000
+++ debian/changelog	2008-01-22 16:06:55 +0000
@@ -1,3 +1,18 @@
+partman-target (52ubuntu2) hardy; urgency=low
+
+  [ Colin Watson ]
+  * Set Vcs-Bzr for Ubuntu.
+
+  [ Evan Dandrea ]
+  * Added support for installing without reformatting existing partitions for
+    the ubiquity-preserve-home specification (LP: #174619):
+    - Remove critical system files from the existing filesystem before
+      installing.
+    - Preserve the UID and GID of the initial user, if possible.  Requires a
+      patch to user-setup.
+
+ -- Evan Dandrea <evand@ubuntu.com>  Tue, 22 Jan 2008 16:06:55 +0000
+
 partman-target (52ubuntu1) hardy; urgency=low
 
   * Resynchronise with Debian. Remaining changes:

=== modified file 'debian/control'
--- debian/control	2007-04-30 11:42:14 +0000
+++ debian/control	2008-01-22 16:06:55 +0000
@@ -5,7 +5,8 @@
 XSBC-Original-Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
 Uploaders: Anton Zinoviev <zinoviev@debian.org>
 Build-Depends: debhelper (>= 4.2.0), po-debconf (>= 0.5.0)
-XS-Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/partman/partman-target
+XS-Original-Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/partman/partman-target
+Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/partman-target/ubuntu
 
 Package: partman-target
 XC-Package-Type: udeb

=== modified file 'debian/partman-target.templates'
--- debian/partman-target.templates	2007-04-30 11:42:14 +0000
+++ debian/partman-target.templates	2008-01-22 16:06:55 +0000
@@ -74,3 +74,14 @@
 Type: text
 _Description: Help on partitioning
 
+Template: partman-target/clear_partitions_failed
+Type: error
+#flag:translate!:3
+_Description: Failed to remove conflicting files
+ The installer needs to remove operating system files from the install target,
+ but was unable to do so.  The install cannot continue.
+
+Template: partman-target/clear_partitions_progress
+Type: text
+_Description: Removing conflicting operating system files...
+

=== modified file 'debian/rules'
--- debian/rules	2007-10-23 17:53:53 +0000
+++ debian/rules	2008-01-22 16:06:55 +0000
@@ -23,6 +23,7 @@
 	debian/install-rc check.d
 	debian/install-rc finish.d
 	debian/install-rc update.d
+	debian/install-rc commit.d
 	debian/install-rc active_partition
 	debian/install-rc choose_partition
 	dh_install choose_method lib/partman


Reply to: