diff options
author | midnightix | 2021-06-20 15:44:57 +0800 |
---|---|---|
committer | midnightix | 2021-06-20 15:44:57 +0800 |
commit | bdbb1011aedfdb74ea515e93d498035927deda5e (patch) | |
tree | b516692afdcfea6bb6c776f966c6a1f4f37c2af5 | |
parent | bef73d1db9fd89d0af661a069d2e44c2ed3c5307 (diff) | |
download | aur-bdbb1011aedfdb74ea515e93d498035927deda5e.tar.gz |
save the user's config before install
-rw-r--r-- | clash-premium-tun.install | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/clash-premium-tun.install b/clash-premium-tun.install index d269f829dedb..29d1af1b5d85 100644 --- a/clash-premium-tun.install +++ b/clash-premium-tun.install @@ -1,3 +1,9 @@ +pre_install() { + if [-f /etc/clash/config.yaml ]; then + mv /etc/clash/config.yaml /etc/clash/config.yaml.bak + fi +} + post_install() { systemctl daemon-reload echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" @@ -13,8 +19,17 @@ post_install() { echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" } +pre_upgrade() { + if [ -f /etc/clash/config.yaml ]; then + mv /etc/clash/config.yaml /etc/clash/config.yaml.user + fi +} + post_upgrade() { - post_install + if [ -f /etc/clash/config.yaml.old ]; then + mv /etc/clash/config.yaml.user /etc/clash/config.yaml + fi + systemctl restart clash } pre_remove() { |