This commit is contained in:
Luk Lu
2022-06-18 10:21:51 +08:00
parent 39b54a54c3
commit 4cbc029412
2 changed files with 16 additions and 1 deletions

View File

@@ -33,15 +33,28 @@ fi
if [ -d $SourcePath ] && [ -d $HomePath ]
then
echo "--- Linking $SourcePath/* to $HomePath/* ..."
pushd $HomePath
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
for homescript in $homescriptlist
do
echo "--- Copying $SourcePath/$homescript to $HomePath/$homescript ..."
rm -fr $homescript.backup
mv $homescript $homescript.backup
cp -r $SourcePath/$homescript $HomePath
done
read -p "Linking .ssh/authorized_keys? Enter l to link or anything else to ignore >> " linkSshKeys
if [ $linkSshKeys == "l" ]
then
echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..."
mkdir -p $HomePath/.ssh
chmod 700 $HomePath/.ssh
if [ -e $HomePath/.ssh/authorized_keys ]
then
rm -fr $HomePath/.ssh/authorized_keys.backup
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup
fi
ln -s $SourcePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys
fi
popd
else
echo "!!! Not existing $SourcePath or $HomePath, please try again."