summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authormidnightix2021-06-20 15:44:57 +0800
committermidnightix2021-06-20 15:44:57 +0800
commitbdbb1011aedfdb74ea515e93d498035927deda5e (patch)
treeb516692afdcfea6bb6c776f966c6a1f4f37c2af5
parentbef73d1db9fd89d0af661a069d2e44c2ed3c5307 (diff)
downloadaur-bdbb1011aedfdb74ea515e93d498035927deda5e.tar.gz
save the user's config before install
-rw-r--r--clash-premium-tun.install17
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() {