forked from IceWhaleTech/CasaOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
120 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ gen | |
/conf/conf.json | ||
__debug_bin | ||
main | ||
CasaOS | ||
github.com | ||
.all-contributorsrc | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
|
105 changes: 105 additions & 0 deletions
105
build/sysroot/usr/share/casaos/shell/delete-old-service.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/bin/bash | ||
### | ||
# @Author: LinkLeong [email protected] | ||
# @Date: 2022-06-30 10:08:33 | ||
# @LastEditors: LinkLeong | ||
# @LastEditTime: 2022-07-01 11:17:54 | ||
# @FilePath: /CasaOS/shell/delete-old-service.sh | ||
# @Description: | ||
### | ||
|
||
((EUID)) && sudo_cmd="sudo" | ||
|
||
# SYSTEM INFO | ||
readonly UNAME_M="$(uname -m)" | ||
|
||
# CasaOS PATHS | ||
readonly CASA_REPO=IceWhaleTech/CasaOS | ||
readonly CASA_UNZIP_TEMP_FOLDER=/tmp/casaos | ||
readonly CASA_BIN=casaos | ||
readonly CASA_BIN_PATH=/usr/bin/casaos | ||
readonly CASA_CONF_PATH=/etc/casaos.conf | ||
readonly CASA_SERVICE_PATH=/etc/systemd/system/casaos.service | ||
readonly CASA_HELPER_PATH=/usr/share/casaos/shell/ | ||
readonly CASA_USER_CONF_PATH=/var/lib/casaos/conf/ | ||
readonly CASA_DB_PATH=/var/lib/casaos/db/ | ||
readonly CASA_TEMP_PATH=/var/lib/casaos/temp/ | ||
readonly CASA_LOGS_PATH=/var/log/casaos/ | ||
readonly CASA_PACKAGE_EXT=".tar.gz" | ||
readonly CASA_RELEASE_API="https://api.github.com/repos/${CASA_REPO}/releases" | ||
readonly CASA_OPENWRT_DOCS="https://github.com/IceWhaleTech/CasaOS-OpenWrt" | ||
|
||
readonly COLOUR_RESET='\e[0m' | ||
readonly aCOLOUR=( | ||
'\e[38;5;154m' # green | Lines, bullets and separators | ||
'\e[1m' # Bold white | Main descriptions | ||
'\e[90m' # Grey | Credits | ||
'\e[91m' # Red | Update notifications Alert | ||
'\e[33m' # Yellow | Emphasis | ||
) | ||
|
||
Target_Arch="" | ||
Target_Distro="debian" | ||
Target_OS="linux" | ||
Casa_Tag="" | ||
|
||
|
||
####################################### | ||
# Custom printing function | ||
# Globals: | ||
# None | ||
# Arguments: | ||
# $1 0:OK 1:FAILED 2:INFO 3:NOTICE | ||
# message | ||
# Returns: | ||
# None | ||
####################################### | ||
|
||
Show() { | ||
# OK | ||
if (($1 == 0)); then | ||
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} OK $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2" | ||
# FAILED | ||
elif (($1 == 1)); then | ||
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[3]}FAILED$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2" | ||
# INFO | ||
elif (($1 == 2)); then | ||
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} INFO $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2" | ||
# NOTICE | ||
elif (($1 == 3)); then | ||
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[4]}NOTICE$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2" | ||
fi | ||
} | ||
|
||
Warn() { | ||
echo -e "${aCOLOUR[3]}$1$COLOUR_RESET" | ||
} | ||
|
||
# 0 Check_exist | ||
Check_Exist() { | ||
#Create Dir | ||
Show 2 "Create Folders." | ||
${sudo_cmd} mkdir -p ${CASA_HELPER_PATH} | ||
${sudo_cmd} mkdir -p ${CASA_LOGS_PATH} | ||
${sudo_cmd} mkdir -p ${CASA_USER_CONF_PATH} | ||
${sudo_cmd} mkdir -p ${CASA_DB_PATH} | ||
${sudo_cmd} mkdir -p ${CASA_TEMP_PATH} | ||
|
||
|
||
Show 2 "Start cleaning up the old version." | ||
|
||
${sudo_cmd} rm -rf /usr/lib/systemd/system/casaos.service | ||
|
||
${sudo_cmd} rm -rf /lib/systemd/system/casaos.service | ||
|
||
${sudo_cmd} rm -rf /usr/local/bin/${CASA_BIN} | ||
|
||
#Clean | ||
if [[ -d "/casaOS" ]]; then | ||
${sudo_cmd} rm -rf /casaOS | ||
fi | ||
Show 0 "Clearance completed." | ||
|
||
$sudo_cmd systemctl restart ${CASA_BIN} | ||
} | ||
Check_Exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# copy to /etc/systemd/system path | ||
[Unit] | ||
Description=Mount USB Drive on %i | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=true | ||
ExecStart=/casaOS/server/shell/usb-mount.sh add %i | ||
ExecStop=/casaOS/server/shell/usb-mount.sh remove %i |