Skip to content

Commit

Permalink
Merge pull request #393 from mylinuxforwork/symlink
Browse files Browse the repository at this point in the history
Symlink updates
  • Loading branch information
mylinuxforwork authored Nov 1, 2024
2 parents 0b9ea07 + 2db8391 commit 17818fb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lib/install/dotfiles/copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

_copy_confirm() {
if gum confirm "Do you want to install the prepared ML4W Dotfiles now?" ;then
echo "Copy started"
echo ":: Copy started"
if [ ! -d ~/$dot_folder ]; then
mkdir -p ~/$dot_folder
echo "~/$dot_folder folder created."
Expand Down
63 changes: 39 additions & 24 deletions lib/install/dotfiles/symlinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,65 @@ echo -e "${NONE}"
echo ":: Symlinks from $HOME/$dot_folder will be created."
echo
# Check home
files=$(ls -a ~/$dot_folder)
files=$(ls -a $HOME/$dot_folder)
for f in $files; do
if [ ! "$f" == "." ] && [ ! "$f" == ".." ] && [ ! "$f" == ".config" ]; then
if [ -f ~/$dot_folder/$f ] ;then
echo ":: Checking for file ~/$f"
if [ -L ~/$f ] ;then
rm ~/$f
if [ -f $HOME/$dot_folder/$f ] ;then
# echo ":: Checking for file $HOME/$f"
if [ -L $HOME/$f ] ;then
rm $HOME/$f
fi
if [ -f ~/$f ] ;then
rm ~/$f
rm $HOME/$f
fi
ln -s $HOME/$dot_folder/$f $HOME
if [ -L $HOME/$f ] ;then
echo ":: SUCCESS $HOME/$dot_folder/$f -> $HOME/$f"
else
echo ":: ERROR $HOME/$dot_folder/$f -> $HOME/$f"
fi
fi
fi
done

# Check .config
files=$(ls -a ~/$dot_folder/.config)
files=$(ls -a $HOME/$dot_folder/.config)
for f in $files; do
if [ ! "$f" == "." ] && [ ! "$f" == ".." ]; then
if [ -d ~/$dot_folder/.config/$f ] ;then
echo ":: Checking for directory ~/.config/$f"
if [ -L ~/.config/$f ] ;then
rm ~/.config/$f
if [ -d $HOME/$dot_folder/.config/$f ] ;then
# echo ":: Checking for directory $HOME/.config/$f"
if [ -L $HOME/.config/$f ] ;then
rm $HOME/.config/$f
fi
if [ -f $HOME/.config/$f ] ;then
rm $HOME/.config/$f
fi
if [ -f ~/.config/$f ] ;then
rm ~/.config/$f
if [ -d $HOME/.config/$f ] ;then
rm -rf $HOME/.config/$f
fi
if [ -d ~/.config/$f ] ;then
rm -rf ~/.config/$f
ln -s $HOME/$dot_folder/.config/$f $HOME/.config
if [ -L $HOME/.config/$f ] ;then
echo ":: SUCCESS $HOME/$dot_folder/.config/$f -> $HOME/.config/$f"
else
echo ":: ERROR $HOME/$dot_folder/.config/$f -> $HOME/.config/$f"
fi
fi
if [ -f ~/$dot_folder/.config/$f ] ;then
echo ":: Checking for file ~/.config/$f"
if [ -L ~/.config/$f ] ;then
rm ~/.config/$f
if [ -f $HOME/$dot_folder/.config/$f ] ;then
# echo ":: Checking for file $HOME/.config/$f"
if [ -L $HOME/.config/$f ] ;then
rm $HOME/.config/$f
fi
if [ -f ~/.config/$f ] ;then
rm ~/.config/$f
if [ -f $HOME/.config/$f ] ;then
rm $HOME/.config/$f
fi
ln -s $HOME/$dot_folder/.config/$f $HOME/.config
if [ -L $HOME/.config/$f ] ;then
echo ":: SUCCESS $HOME/$dot_folder/.config/$f -> $HOME/.config/$f"
else
echo ":: ERROR $HOME/$dot_folder/.config/$f -> $HOME/.config/$f"
fi
fi
fi
done

# Run GNU Stow
stow --dir="$HOME/$dot_folder" --target="$HOME" .

echo
7 changes: 0 additions & 7 deletions lib/install/packages/remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,3 @@ if [[ $(_isInstalledAUR "hyprlock-git") == 0 ]]; then
echo ":: hyprlock can now be installed."
echo
fi

# Remove oh-my-posh
if [[ $(_isInstalledAUR "oh-my-posh") == 0 ]]; then
$aur_helper --noconfirm -R oh-my-posh
echo ":: oh-my-posh uninstalled."
echo
fi
2 changes: 1 addition & 1 deletion lib/options/options/shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ elif [[ $shell == "zsh" ]] ;then
echo ":: Shell is now zsh."

# Installing oh-my-posh
yay -S oh-my-posh-bin
yay -S oh-my-posh

# Installing oh-my-zsh
if [ ! -d "$HOME/.oh-my-zsh" ]; then
Expand Down
1 change: 0 additions & 1 deletion share/packages/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ packages=(
"rsync"
"git"
"figlet"
"stow"
"sed"
"vim"
"xdg-user-dirs"
Expand Down
2 changes: 1 addition & 1 deletion share/packages/profiles/default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ packages=(
"polkit-gnome"
"zsh"
"zsh-completions"
"oh-my-posh-bin"
"oh-my-posh"
"fzf"
"pavucontrol"
"papirus-icon-theme"
Expand Down

0 comments on commit 17818fb

Please sign in to comment.