Setup of /home
New Home / Configuration files
Up to now I had not mounted the partition containing /home. This is done now from the console [ALT]+[F1] and no user logged in. One my also use the new home and copy only the files one wants to keep. A sample script to do such is the following
CopyConfigFiles.script
#!/bin/bash
# --------------------------------------------------------- #
copy_and_backup_Files ()
{
COPY=$3
FROMDIR="$1"
DESTDIR="$2"
if [ -d "$FROMDIR/$COPY" ] # Test if origin directory exists.
then
if [ -d "$DESTDIR/$COPY" ] # Test if target directory exists.
then
if [ -d "$DESTDIR/$COPY-old" ] # Test if target directory exists.
then
rm -rf "$DESTDIR/$COPY-old"
fi
mv "$DESTDIR/$COPY" "$DESTDIR/$COPY-old"
cp -rv "$FROMDIR/$COPY" "$DESTDIR"
else
echo "> Kopieren..."
cp -rv "$FROMDIR/$COPY" "$DESTDIR"
fi
fi
return 0 # Success.
}
# --------------------------------------------------------- #
copy_and_backup_File ()
{
COPY=$3
FROMDIR="$1"
DESTDIR="$2"
if [ -e "$FROMDIR/$COPY" ] # Test if origin directory exists.
then
if [ -e "$DESTDIR/$COPY" ] # Test if target directory exists.
then
if [ -e "$DESTDIR/$COPY-old" ] # Test if target directory exists.
then
rm "$DESTDIR/$COPY-old"
fi
mv "$DESTDIR/$COPY" "$DESTDIR/$COPY-old"
cp -v "$FROMDIR/$COPY" "$DESTDIR"
else
echo "> Kopieren..."
cp -v "$FROMDIR/$COPY" "$DESTDIR"
fi
fi
return 0 # Success.
}
echo "-----------------------------------"
OLDHOME="/home/matthias-old"
NEWHOME="/home/matthias"
COPY=".spamassassin"
copy_and_backup_Files "$OLDHOME" "$NEWHOME" $COPY
COPY="kmail"
CPATH=".kde/share/apps"
copy_and_backup_Files "$OLDHOME/$CPATH" "$NEWHOME/$CPATH" $COPY
CPATH=".kde/share/apps"
COPYDIR=(akregator kwallet kontact kile kabc kaddressbook knode kopete korganizer)
for DIR in "${COPYDIR[@]}"
do
copy_and_backup_Files "$OLDHOME/$CPATH" "$NEWHOME/$CPATH" $DIR
done
CPATH=".kde/share/config"
COPYFILE=(akregatorrc amarokrc digikamrc emaildefaults emailidentities kab2kabcrc kaccessrc kaddressbook_addrconfig kaddressbookrc katerc kateschemarc katesyntaxhighlightingrc kilerc kmail.eventsrc kmailrc knoderc kopeterc korganizerrc kwalletrc rsibreakrc)
for COPY in "${COPYFILE[@]}"
do
copy_and_backup_File "$OLDHOME/$CPATH" "$NEWHOME/$CPATH" $COPY
done |
#!/bin/bash
# --------------------------------------------------------- #
copy_and_backup_Files ()
{
COPY=$3
FROMDIR="$1"
DESTDIR="$2"
if [ -d "$FROMDIR/$COPY" ] # Test if origin directory exists.
then
if [ -d "$DESTDIR/$COPY" ] # Test if target directory exists.
then
if [ -d "$DESTDIR/$COPY-old" ] # Test if target directory exists.
then
rm -rf "$DESTDIR/$COPY-old"
fi
mv "$DESTDIR/$COPY" "$DESTDIR/$COPY-old"
cp -rv "$FROMDIR/$COPY" "$DESTDIR"
else
echo "> Kopieren..."
cp -rv "$FROMDIR/$COPY" "$DESTDIR"
fi
fi
return 0 # Success.
}
# --------------------------------------------------------- #
copy_and_backup_File ()
{
COPY=$3
FROMDIR="$1"
DESTDIR="$2"
if [ -e "$FROMDIR/$COPY" ] # Test if origin directory exists.
then
if [ -e "$DESTDIR/$COPY" ] # Test if target directory exists.
then
if [ -e "$DESTDIR/$COPY-old" ] # Test if target directory exists.
then
rm "$DESTDIR/$COPY-old"
fi
mv "$DESTDIR/$COPY" "$DESTDIR/$COPY-old"
cp -v "$FROMDIR/$COPY" "$DESTDIR"
else
echo "> Kopieren..."
cp -v "$FROMDIR/$COPY" "$DESTDIR"
fi
fi
return 0 # Success.
}
echo "-----------------------------------"
OLDHOME="/home/matthias-old"
NEWHOME="/home/matthias"
COPY=".spamassassin"
copy_and_backup_Files "$OLDHOME" "$NEWHOME" $COPY
COPY="kmail"
CPATH=".kde/share/apps"
copy_and_backup_Files "$OLDHOME/$CPATH" "$NEWHOME/$CPATH" $COPY
CPATH=".kde/share/apps"
COPYDIR=(akregator kwallet kontact kile kabc kaddressbook knode kopete korganizer)
for DIR in "${COPYDIR[@]}"
do
copy_and_backup_Files "$OLDHOME/$CPATH" "$NEWHOME/$CPATH" $DIR
done
CPATH=".kde/share/config"
COPYFILE=(akregatorrc amarokrc digikamrc emaildefaults emailidentities kab2kabcrc kaccessrc kaddressbook_addrconfig kaddressbookrc katerc kateschemarc katesyntaxhighlightingrc kilerc kmail.eventsrc kmailrc knoderc kopeterc korganizerrc kwalletrc rsibreakrc)
for COPY in "${COPYFILE[@]}"
do
copy_and_backup_File "$OLDHOME/$CPATH" "$NEWHOME/$CPATH" $COPY
done
Directories and Links
A lot of stuff is on other partitions than / or /home. So I prepare some directories and links so that I can access all these folders from within any home directory. I prepared a script so that this can be done automatically.
#!/bin/bash
HOME="/home/matthias"
# --------------------------------------------------------- #
create_dir ()
{
if [ -d "$1" ] # Test if target directory exists.
then
echo ""
else
mkdir $1
fi
return 0 # Success.
}
# --------------------------------------------------------- #
create_link ()
{
if [ -d "$2" ] # Test if target directory exists.
then
echo "$2 existiert schon"
else
ln -s $1 $2
fi
return 0 # Success.
}
MUSIK="/mnt/hdb2/MP3z/Sammlung"
INSTALL="/mnt/hdb2/INSTALL"
BACKUP="/mnt/hdb2/SICHERUNG"
LINKDIR="/home/links"
create_dir $LINKDIR
create_link $MUSIK "$LINKDIR/Musik"
create_link $INSTALL "$LINKDIR/Install"
create_link $BACKUP "$LINKDIR/Backup"
chown -R root:users $LINKDIR
HOME="/home/matthias"
create_dir "$HOME/Download"
create_link "$LINKDIR/Musik" "$HOME/Musik"
create_link "$LINKDIR/Install" "$HOME/Installation"
create_link "$LINKDIR/Backup" "$HOME/Sicherung"
MEDIA="/media"
create_link "$MEDIA" "$HOME/Medien"
chown -R root:users $MOUNT
chmod g+w $MOUNT/*
MOUNT="/mnt"
for dir in $(ls /mnt/ -A);
do
create_link "$MOUNT/$dir" "$MEDIA/$dir"
done |
#!/bin/bash
HOME="/home/matthias"
# --------------------------------------------------------- #
create_dir ()
{
if [ -d "$1" ] # Test if target directory exists.
then
echo ""
else
mkdir $1
fi
return 0 # Success.
}
# --------------------------------------------------------- #
create_link ()
{
if [ -d "$2" ] # Test if target directory exists.
then
echo "$2 existiert schon"
else
ln -s $1 $2
fi
return 0 # Success.
}
MUSIK="/mnt/hdb2/MP3z/Sammlung"
INSTALL="/mnt/hdb2/INSTALL"
BACKUP="/mnt/hdb2/SICHERUNG"
LINKDIR="/home/links"
create_dir $LINKDIR
create_link $MUSIK "$LINKDIR/Musik"
create_link $INSTALL "$LINKDIR/Install"
create_link $BACKUP "$LINKDIR/Backup"
chown -R root:users $LINKDIR
HOME="/home/matthias"
create_dir "$HOME/Download"
create_link "$LINKDIR/Musik" "$HOME/Musik"
create_link "$LINKDIR/Install" "$HOME/Installation"
create_link "$LINKDIR/Backup" "$HOME/Sicherung"
MEDIA="/media"
create_link "$MEDIA" "$HOME/Medien"
chown -R root:users $MOUNT
chmod g+w $MOUNT/*
MOUNT="/mnt"
for dir in $(ls /mnt/ -A);
do
create_link "$MOUNT/$dir" "$MEDIA/$dir"
done
Ähnliche Beiträge
Hi,
I’m the maintainer of Beagle, and I just wanted to let you know that there’s a new version out which is a lot more resource friendly, available here:
http://software.opensuse.org/download/Beagle/
I’d appreciate it if you could try it and let me know if you see problems with it.
Thanks,
Joe