From eedae5310d507c2a7248f5e83d5f7dea7cf5d1b9 Mon Sep 17 00:00:00 2001 From: filesite Date: Mon, 1 Jul 2024 07:47:32 +0800 Subject: [PATCH] add script to refresh shortcuts, uninstall machete --- funs.sh | 21 +++++++++++++++++++++ refresh.sh | 12 ++++++++++++ uninstall.sh | 23 +++++++++++++++++++++++ upgrade.sh | 1 + 4 files changed, 57 insertions(+) create mode 100644 refresh.sh create mode 100644 uninstall.sh diff --git a/funs.sh b/funs.sh index 553c282..b34f933 100644 --- a/funs.sh +++ b/funs.sh @@ -21,6 +21,16 @@ theend () { echo "" } +# 显示卸载信息 +goodbye () { + echo "" + echo "==即将卸载machete,不会影响本地保存的照片、视频==" + echo "* 停止machete容器" + echo "* 删除machete容器" + echo "* 删除桌面快捷方式" + echo "" +} + # 获取用户桌面绝对路径 getHomePath () { path=`cd ~/ && pwd` @@ -218,6 +228,17 @@ createShortcuts () { fi } +# 删除桌面快捷方式 +deleteShortcuts () { + type=$1 + + if [ "${type}" == "album" ]; then + rm -f ~/Desktop/相册.url + else + rm -f ~/Desktop/视频.url + fi +} + # 升级docker容器里的代码到最新版 upgradeMacheteInContainers () { name=$1 diff --git a/refresh.sh b/refresh.sh new file mode 100644 index 0000000..b46e02c --- /dev/null +++ b/refresh.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# 引入公用方法 +. ./funs.sh + +container=$1 +if [ -z "${container}" ]; then + container="album" +fi + +# ===== 更新快捷方式ip地址 ===== +createShortcuts "${container}" diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..cbd7a8e --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# 引入公用方法 +. ./funs.sh + +container=$1 +if [ -z "${container}" ]; then + container="album" +fi + +# ===== 卸载machete ===== +goodbye + +echo "" +echo "正在停止machete容器..." +docker stop "machete_${container}" +echo "正在删除machete容器..." +docker rm "machete_${container}" +echo "正在删除桌面快捷方式..." +deleteShortcuts "${container}" + +echo "${container}卸载完成" +echo "" diff --git a/upgrade.sh b/upgrade.sh index 85e4ca3..9e0e4d3 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -8,4 +8,5 @@ if [ -z "${container}" ]; then container="album" fi +# ===== 升级machete ===== upgradeMacheteInContainers "${container}"