Fix if statement conditions and force dotfile checkout (not clone)

This commit is contained in:
2025-05-02 16:45:48 +02:00
parent cb0c8c3805
commit d0fa0a7c22
2 changed files with 7 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ if ! sudo snapper -c root get-config &> /dev/null; then
echo -e "\e[31m❌ Error: Snapper create-config failed. Trying auto fix by deleting the old subvolume.\e[0m" >&2
# Removes the submodule already created and re-create it from snapper
# I can use mount -a since the fstab doens't use subvolume id
if ! sudo umount /.snapshots/ && sudo rmdir /.snapshots/ && sudo snapper --config root create-config / &> /dev/null && sudo mount -a; then
if ! (sudo umount /.snapshots/ && sudo rmdir /.snapshots/ && sudo snapper --config root create-config / &> /dev/null && sudo mount -a); then
echo -e "\e[31m❌ Error: Snapper create-config failed. Please refer to wiki. Probably the subvolume already exists. Manual intervation needed.\e[0m" >&2
exit -1
fi

View File

@@ -5,8 +5,11 @@ echo -e "\e[31m❌ Manual intervation needed: please be sure to add your ssh key
echo -e "\e[31mPress any key to continue\e[0m" >&2
read -r
cd $HOME
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
echo ".cfg" >> .gitignore
if ! git clone --bare git@github.com:danielepintore/dotfiles.git $HOME/.cfg && config checkout && config config --local status.showUntrackedFiles no; then
if ! (git clone --bare git@github.com:danielepintore/dotfiles.git $HOME/.cfg &&
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME checkout -f &&
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME config --local status.showUntrackedFiles no); then
echo -e "\e[31m❌ Manual intervation needed: failed to setup your dotfiles.\e[0m" >&2
echo -e "\e[31mPress any key to continue\e[0m" >&2
read -r
exit 1
fi