fix: snapper config

This commit is contained in:
2025-07-09 09:26:58 +02:00
parent e3fa429c49
commit 5a1df201e7

View File

@@ -11,19 +11,21 @@ if ! sudo snapper -c root get-config &> /dev/null; then
# 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
echo -e "\e[31m❌ Error: Snapper create-config failed. Please refer to wiki. Probably the subvolume already exists. Manual intervation needed.\e[0m" >&2
echo -e "\e[31m❌ Error: Snapper create-config failed. Please refer to wiki. Probably the subvolume already exists. Manual intervation needed. Setup will continue but you have to fix snapper later.\e[0m" >&2
echo -e "\e[31mPress any key to continue\e[0m" >&2
read -r
exit -1
fi
fi
# configure snap-pac for snapshots
sudo sed -i "s/^TIMELINE_CREATE=.*/TIMELINE_CREATE=\"no\"/" /etc/snapper/configs/root
sudo sed -i "s/^TIMELINE_CREATE=.*/TIMELINE_CREATE=\"yes\"/" /etc/snapper/configs/root
sudo sed -i "s/^TIMELINE_LIMIT_HOURLY=.*/TIMELINE_LIMIT_HOURLY=\"5\"/" /etc/snapper/configs/root
sudo sed -i "s/^TIMELINE_LIMIT_DAILY=.*/TIMELINE_LIMIT_DAILY=\"7\"/" /etc/snapper/configs/root
sudo sed -i "s/^TIMELINE_LIMIT_WEEKLY=.*/TIMELINE_LIMIT_WEEKLY=\"2\"/" /etc/snapper/configs/root
sudo sed -i "s/^TIMELINE_LIMIT_MONTHLY=.*/TIMELINE_LIMIT_MONTHLY=\"5\"/" /etc/snapper/configs/root
sudo systemctl enable --now snapper-timeline.timer
sudo systemctl enable --now snapper-cleanup.timer
pacman -S snap-pac --noconfirm
sudo pacman -S snap-pac --noconfirm
fi