summarylogtreecommitdiffstats
path: root/pamac.install
diff options
context:
space:
mode:
Diffstat (limited to 'pamac.install')
-rw-r--r--pamac.install48
1 files changed, 42 insertions, 6 deletions
diff --git a/pamac.install b/pamac.install
index fb3df4aa94ef..524f2455707c 100644
--- a/pamac.install
+++ b/pamac.install
@@ -1,17 +1,38 @@
+msg() {
+ ALL_OFF="\e[1;0m"
+ BOLD="\e[1;1m"
+ GREEN="${BOLD}\e[1;32m"
+ local mesg=$1; shift
+ printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+restore_conf() {
+ PAMAC_NEW="$(date +%m%d%M%S)"
+ if [ -f "/etc/pamac.conf.pacsave" ]; then
+ msg "You had an old /etc/pamac.conf.pacsave file. We restore it for you."
+ msg "You can find your new pamac.conf saved as \`/etc/pamac-new-${PAMAC_NEW}.conf\`"
+ mv /etc/pamac.conf /etc/pamac-new-${PAMAC_NEW}.conf
+ mv /etc/pamac.conf.pacsave /etc/pamac.conf
+ fi
+}
+
post_install() {
- # enable flatpak repo
+ # enable flatpak repo
if [ -f /usr/bin/flatpak ]; then
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
# enable systemd timers
- ln -sf /usr/lib/systemd/system/pamac-cleancache.timer /etc/systemd/system/multi-user.target.wants
- #ln -sf /usr/lib/systemd/system/pamac-mirrorlist.timer /etc/systemd/system/multi-user.target.wants
+ mkdir -p /etc/systemd/system/timers.target.wants
+ ln -sf /usr/lib/systemd/system/pamac-cleancache.timer /etc/systemd/system/timers.target.wants/pamac-cleancache.timer
+ # ln -sf /usr/lib/systemd/system/pamac-mirrorlist.timer /etc/systemd/system/timers.target.wants/pamac-mirrorlist.timer
# polkit agent
printf '==> An authentication agent is required\n'
printf ' Cinnamon, Deepin, GNOME, GNOME Flashback, KDE, LXDE, LXQt, MATE and Xfce\n'
printf ' have an authentication agent already.\n'
printf ' See https://wiki.archlinux.org/index.php/Polkit#Authentication_agents\n'
printf ' for other desktop environments.\n'
+ # restore old conf
+ restore_conf
}
post_upgrade() {
@@ -19,10 +40,25 @@ post_upgrade() {
if [ -f /usr/bin/flatpak ]; then
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
+ # restore old conf
+ if [ "$(vercmp $2 7.3.5-3)" -lt 0 ]; then
+ restore_conf
+ fi
+
+ if [ "$(vercmp $2 8.0.3-5)" -lt 0 ]; then
+ # remove wrong placed symlinks
+ msg "Updating timer symlinks"
+ [[ -e /etc/systemd/system/multi-user.target.wants/pamac-cleancache.timer ]] && rm -f /etc/systemd/system/multi-user.target.wants/pamac-cleancache.timer
+ # [[ -e /etc/systemd/system/multi-user.target.wants/pamac-mirrorlist.timer ]] && rm -f /etc/systemd/system/multi-user.target.wants/pamac-mirrorlist.timer
+ # enable systemd timers
+ mkdir -p /etc/systemd/system/timers.target.wants
+ ln -sf /usr/lib/systemd/system/pamac-cleancache.timer /etc/systemd/system/timers.target.wants/pamac-cleancache.timer
+ # ln -sf /usr/lib/systemd/system/pamac-mirrorlist.timer /etc/systemd/system/timers.target.wants/pamac-mirrorlist.timer
+ fi
}
post_remove() {
# disable systemd timers
- rm -f /etc/systemd/system/multi-user.target.wants/pamac-cleancache.timer
- #rm -f /etc/systemd/system/multi-user.target.wants/pamac-mirrorlist.timer
-} \ No newline at end of file
+ rm -f /etc/systemd/system/timers.target.wants/pamac-cleancache.timer
+ # rm -f /etc/systemd/system/timers.target.wants/pamac-mirrorlist.timer
+}