mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-03 06:27:21 +01:00
add a setup script for my dotfiles
This commit is contained in:
28
setup.sh
Executable file
28
setup.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
INSTALL_DIR=~/.dotfiles
|
||||||
|
TARGET_DIR=$HOME
|
||||||
|
|
||||||
|
for ITEM in `ls $INSTALL_DIR` ; do
|
||||||
|
|
||||||
|
if [ "$ITEM" = "setup.sh" ]
|
||||||
|
then
|
||||||
|
continue;
|
||||||
|
fi
|
||||||
|
|
||||||
|
TARGET_NAME="$TARGET_DIR/.$ITEM";
|
||||||
|
|
||||||
|
# backup needed
|
||||||
|
if [ -f $TARGET_NAME ] || [ -h $TARGET_NAME ] || [ -d $TARGET_NAME ]
|
||||||
|
then
|
||||||
|
echo "Found $TARGET_NAME. Backing up to ${TARGET_NAME}.pre_dotfiles";
|
||||||
|
mv $TARGET_NAME ${TARGET_NAME}.pre_dotfiles || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -s $INSTALL_DIR/$ITEM $TARGET_NAME;
|
||||||
|
echo "Genereated symbolic link from $TARGET_NAME to $INSTALL_DIR/$ITEM";
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
echo 'dotfiles are installed'
|
||||||
|
|
||||||
Reference in New Issue
Block a user