To generate the install.sh file or update it you can use this org file using the “config (install.sh)” section.
Run the next command to create/update the config in the install.sh file using the org-babel-tangle in your emacs running C-c C-c
into this block or run in your emacs M-x org-babel-tangle
(org-babel-tangle)
After update you will need to run the next command on the install file to make it executable
chmod +x install.sh
Link the files to the specific path example: “link -f $PWD/test.txt $FILE “test.txt file”
link (){
#echo $1 $2 $3 $4
# Check if the file or dir already exist
if test $1 $3; then
echo -n "🚨 A $4 detected, do you want to overwrite it? [Y/n] "
read answer
if [ "$answer" != "${answer#[Nn]}" ]; then
echo "⏩ Skipped"
echo ""
return 0
fi
fi
#Link the profile
rm $3 -rf
echo -n "🟢 Linking the $4 \n"
echo ""
ln -s $2 $3
return 0
}
PROFILE_FILE=$HOME/.profile
link -f $PWD/.profile $PROFILE_FILE ".profile file"
BASHFILE=$HOME/.bashrc
link -f $PWD/.bash $BASHFILE ".bashrc file"
ZSHRC_FILE=$HOME/.zshrc
link -f $PWD/.zshrc $ZSHRC_FILE ".zshrc file"
DOOM_DIR=$HOME/.doom.d
link -d $PWD/emacs/.doom.d $DOOM_DIR ".doom.d DIR"