diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-04-14 13:46:12 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-04-14 13:46:12 +0000 |
commit | 1be510f9529cb082f802408b472a77d074b394c0 (patch) | |
tree | b175f9d5fcb107576dabc768e7bd04d4a3e491a0 /zarb-ml/mageia-discuss/attachments/20121130/e5b29adf | |
parent | fa5098cf210b23ab4f419913e28af7b1b07dafb2 (diff) | |
download | archives-master.tar archives-master.tar.gz archives-master.tar.bz2 archives-master.tar.xz archives-master.zip |
Diffstat (limited to 'zarb-ml/mageia-discuss/attachments/20121130/e5b29adf')
-rw-r--r-- | zarb-ml/mageia-discuss/attachments/20121130/e5b29adf/attachment-0001.bin | 85 | ||||
-rw-r--r-- | zarb-ml/mageia-discuss/attachments/20121130/e5b29adf/attachment.bin | 85 |
2 files changed, 170 insertions, 0 deletions
diff --git a/zarb-ml/mageia-discuss/attachments/20121130/e5b29adf/attachment-0001.bin b/zarb-ml/mageia-discuss/attachments/20121130/e5b29adf/attachment-0001.bin new file mode 100644 index 000000000..aa9c13873 --- /dev/null +++ b/zarb-ml/mageia-discuss/attachments/20121130/e5b29adf/attachment-0001.bin @@ -0,0 +1,85 @@ +#!/bin/sh +# This script is used to save an old configuration allowing +# a new installation. Thus the local hidden files and directories +# cannot interfer with the new installation. +# /home must be a partition (/ home not included in / partition) +# Each user gets a new fresh environment. All old directories and files +# are moved in ~/ancien and nothing is lost. +# The system configuration is copied in /home/frigo, allowing to format / +# Pierre Jarillon - 2009 - License GPL + +ETC=/etc +FRIGO=/home/frigo + +date + +# ------------------------------------------------------------------------------------- +if [ $(basename `pwd`) != 'home' ] +then + echo "Error : The pending directory must be home. Use the command : cd /home"; + exit 1; +fi + +echo "Ce script is intended to be executed before a new system reinstallation." +echo "It allows to create a new fresh session for each user without any lost." +echo "System datas are saved in $FRIGO and old /home/*/ are moved in /home/*/ancien/" +echo "All sessions using /home must be closed." +echo "" +echo -n "OK to continue? [y/N]: " +read response +if [ -z $response ]; then + response=n +fi +echo "" +case $response in + [OoYy]*) + echo "OK..." + ;; + *) + echo "Aborted" + exit 0 ;; +esac + +# -----------------Safe storage location----------------------------------------------- + +if [ -d $FRIGO ]; then rm -rf $FRIGO; fi; +mkdir $FRIGO +mkdir $FRIGO/faces + +# ------------------------------------------------------------------------------------- + +ls -1|while read d +do + if [ ! -d $d ]; then continue; fi + n=`basename $d` + x="x" + x=`grep ^$n: ../etc/passwd|cut -d: -f1` + if [ m$x != m$n ] ;then continue ;fi + g=`grep ^$n: ../etc/passwd|cut -d: -f4` +# echo $n > $FRIGO/liste + [ -f /usr/share/faces/$n.png ] && cp /usr/share/faces/$n.png $FRIGO/faces/ + echo "Traité : $n groupe : $g" + + date > $n/ladate.$n.txt + cp -a /etc/skel . + chown -R $n:$g skel + mv $n skel/ + mv skel/$n skel/ancien + mv skel $n +done + +# A full copy of /etc in /home/$FRIGO is the best. In fact, few files are used +# If the user uid 500 is saved it is not necessary to ask for it during the install. + +# cp -a /etc $FRIGO/ + +awk -F : '{a=$3+0; if ((a >499)&&(a<10000))print $0}' $ETC/passwd > $FRIGO/passwd +cut -d: -f1 $FRIGO/passwd|while read user; do grep "^$user" $ETC/group >> $FRIGO/group; done +cut -d: -f1 $FRIGO/passwd|while read user; do grep "^$user" $ETC/shadow >> $FRIGO/shadow; done +grep HOSTNAME $ETC/sysconfig/network > $FRIGO/hostname +cp $ETC/hosts $FRIGO/hosts +if [ -d $ETC/ssh ] +then + mkdir $FRIGO/ssh; cp -p $ETC/ssh/ssh_host_* $FRIGO/ssh/ +fi +echo "Done." diff --git a/zarb-ml/mageia-discuss/attachments/20121130/e5b29adf/attachment.bin b/zarb-ml/mageia-discuss/attachments/20121130/e5b29adf/attachment.bin new file mode 100644 index 000000000..aa9c13873 --- /dev/null +++ b/zarb-ml/mageia-discuss/attachments/20121130/e5b29adf/attachment.bin @@ -0,0 +1,85 @@ +#!/bin/sh +# This script is used to save an old configuration allowing +# a new installation. Thus the local hidden files and directories +# cannot interfer with the new installation. +# /home must be a partition (/ home not included in / partition) +# Each user gets a new fresh environment. All old directories and files +# are moved in ~/ancien and nothing is lost. +# The system configuration is copied in /home/frigo, allowing to format / +# Pierre Jarillon - 2009 - License GPL + +ETC=/etc +FRIGO=/home/frigo + +date + +# ------------------------------------------------------------------------------------- +if [ $(basename `pwd`) != 'home' ] +then + echo "Error : The pending directory must be home. Use the command : cd /home"; + exit 1; +fi + +echo "Ce script is intended to be executed before a new system reinstallation." +echo "It allows to create a new fresh session for each user without any lost." +echo "System datas are saved in $FRIGO and old /home/*/ are moved in /home/*/ancien/" +echo "All sessions using /home must be closed." +echo "" +echo -n "OK to continue? [y/N]: " +read response +if [ -z $response ]; then + response=n +fi +echo "" +case $response in + [OoYy]*) + echo "OK..." + ;; + *) + echo "Aborted" + exit 0 ;; +esac + +# -----------------Safe storage location----------------------------------------------- + +if [ -d $FRIGO ]; then rm -rf $FRIGO; fi; +mkdir $FRIGO +mkdir $FRIGO/faces + +# ------------------------------------------------------------------------------------- + +ls -1|while read d +do + if [ ! -d $d ]; then continue; fi + n=`basename $d` + x="x" + x=`grep ^$n: ../etc/passwd|cut -d: -f1` + if [ m$x != m$n ] ;then continue ;fi + g=`grep ^$n: ../etc/passwd|cut -d: -f4` +# echo $n > $FRIGO/liste + [ -f /usr/share/faces/$n.png ] && cp /usr/share/faces/$n.png $FRIGO/faces/ + echo "Traité : $n groupe : $g" + + date > $n/ladate.$n.txt + cp -a /etc/skel . + chown -R $n:$g skel + mv $n skel/ + mv skel/$n skel/ancien + mv skel $n +done + +# A full copy of /etc in /home/$FRIGO is the best. In fact, few files are used +# If the user uid 500 is saved it is not necessary to ask for it during the install. + +# cp -a /etc $FRIGO/ + +awk -F : '{a=$3+0; if ((a >499)&&(a<10000))print $0}' $ETC/passwd > $FRIGO/passwd +cut -d: -f1 $FRIGO/passwd|while read user; do grep "^$user" $ETC/group >> $FRIGO/group; done +cut -d: -f1 $FRIGO/passwd|while read user; do grep "^$user" $ETC/shadow >> $FRIGO/shadow; done +grep HOSTNAME $ETC/sysconfig/network > $FRIGO/hostname +cp $ETC/hosts $FRIGO/hosts +if [ -d $ETC/ssh ] +then + mkdir $FRIGO/ssh; cp -p $ETC/ssh/ssh_host_* $FRIGO/ssh/ +fi +echo "Done." |