[PC-BSD Commits] r6157 - pcbsd/trunk/pc-sysinstall/backend

svn at pcbsd.org svn at pcbsd.org
Tue Feb 2 09:56:22 PST 2010


Author: kris
Date: 2010-02-02 09:56:21 -0800 (Tue, 02 Feb 2010)
New Revision: 6157

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-upgrade.sh
Log:

Added ability to massage / fix user skel files when doing an upgrade, which should allow easier
updates from 7.x -> 8.x, and fix potential user data corruption when trying to do a repair



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-upgrade.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-upgrade.sh	2010-02-02 16:50:02 UTC (rev 6156)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-upgrade.sh	2010-02-02 17:56:21 UTC (rev 6157)
@@ -141,9 +141,52 @@
 
 };
 
+copy_skel_files_upgrade()
+{
+
+    # Now make sure we fix any user profile scripts, which cause problems from 7.x->8.x
+    echo '#!/bin/sh
+
+cd /home
+for i in `ls`
+do
+
+  # Backup the old profile dirs
+  if [ -d "${i}" ]
+  then
+    mv /home/${i}/.kde4 /home/${i}/.kde4.preUpgrade >/dev/null 2>/dev/null
+    mv /home/${i}/.kde /home/${i}/.kde.preUpgrade >/dev/null 2>/dev/null
+    mv /home/${i}/.fluxbox /home/${i}/.fluxbox.preUpgrade >/dev/null 2>/dev/null
+
+    # Copy over the skel directories
+    tar cv --exclude "./dot.*" -f - -C /usr/share/skel . 2>/dev/null | tar xvf - -C /home/${i} 2>/dev/null
+
+    for j in `ls /usr/share/skel/dot*`
+    do
+      dname=`echo ${j} | sed s/dot//`
+      cp /usr/share/skel/${j} /home/${i}/${dname}
+    done
+
+    chown -R ${i}:${i} /home/${i}
+  fi
+
+done
+' >${FSMNT}/.fixUserProfile.sh  
+    chmod 755 ${FSMNT}/.fixUserProfile.sh
+    chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null
+    rm ${FSMNT}/.fixUserProfile.sh
+
+};
+
 # Function which unmounts all the mounted file-systems
 unmount_upgrade()
 {
+
+   # If on PC-BSD, make sure we copy any fixed skel files
+   if [ "$INSTALLTYPE" != "FreeBSD" ] ; then
+     copy_skel_files_upgrade
+   fi
+
    cd /
 
    # Unmount FS



More information about the Commits mailing list