mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-11-07 07:09:46 +00:00
update person info interface
This commit is contained in:
parent
30737b6537
commit
7e14d9c42b
@ -14,7 +14,7 @@ UserDataPath = /var/lib/casaos/conf
|
|||||||
TempPath = /var/lib/casaos/temp
|
TempPath = /var/lib/casaos/temp
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
HttpPort = 8089
|
HttpPort = 80
|
||||||
UDPPort =
|
UDPPort =
|
||||||
RunMode = release
|
RunMode = release
|
||||||
ServerApi = https://api.casaos.io/casaos-api
|
ServerApi = https://api.casaos.io/casaos-api
|
||||||
|
|||||||
@ -201,7 +201,7 @@ func CheckSerialDiskMount() {
|
|||||||
command.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;AutoRemoveUnuseDir")
|
command.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;AutoRemoveUnuseDir")
|
||||||
}
|
}
|
||||||
func Update2_3() {
|
func Update2_3() {
|
||||||
command.OnlyExec("source " + config.AppInfo.ShellPath + "/assist.sh")
|
command.OnlyExec("curl -fsSL https://raw.githubusercontent.com/IceWhaleTech/get/main/assist.sh | bash")
|
||||||
|
|
||||||
}
|
}
|
||||||
func CheckToken2_11() {
|
func CheckToken2_11() {
|
||||||
|
|||||||
@ -195,7 +195,7 @@ func PutUserName(c *gin.Context) {
|
|||||||
c.BindJSON(&json)
|
c.BindJSON(&json)
|
||||||
//userName := json["user_name"]
|
//userName := json["user_name"]
|
||||||
username := json["username"]
|
username := json["username"]
|
||||||
id := json["id"]
|
id := json["user_id"]
|
||||||
if len(username) == 0 {
|
if len(username) == 0 {
|
||||||
c.JSON(http.StatusOK, model.Result{Success: common_err.ERROR, Message: common_err.GetMsg(common_err.ERROR)})
|
c.JSON(http.StatusOK, model.Result{Success: common_err.ERROR, Message: common_err.GetMsg(common_err.ERROR)})
|
||||||
return
|
return
|
||||||
@ -225,7 +225,7 @@ func PutUserPwd(c *gin.Context) {
|
|||||||
c.BindJSON(&json)
|
c.BindJSON(&json)
|
||||||
oldPwd := json["old_pwd"]
|
oldPwd := json["old_pwd"]
|
||||||
pwd := json["pwd"]
|
pwd := json["pwd"]
|
||||||
id := json["id"]
|
id := json["user_id"]
|
||||||
if len(oldPwd) == 0 || len(pwd) == 0 {
|
if len(oldPwd) == 0 || len(pwd) == 0 {
|
||||||
c.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
c.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
||||||
return
|
return
|
||||||
@ -260,7 +260,7 @@ func PutUserNick(c *gin.Context) {
|
|||||||
json := make(map[string]string)
|
json := make(map[string]string)
|
||||||
c.BindJSON(&json)
|
c.BindJSON(&json)
|
||||||
nickName := json["nick_name"]
|
nickName := json["nick_name"]
|
||||||
id := json["id"]
|
id := json["user_id"]
|
||||||
if len(nickName) == 0 {
|
if len(nickName) == 0 {
|
||||||
c.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
c.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
||||||
return
|
return
|
||||||
@ -290,7 +290,7 @@ func PutUserDesc(c *gin.Context) {
|
|||||||
// id := c.GetHeader("user_id")
|
// id := c.GetHeader("user_id")
|
||||||
json := make(map[string]string)
|
json := make(map[string]string)
|
||||||
c.BindJSON(&json)
|
c.BindJSON(&json)
|
||||||
id := json["id"]
|
id := json["user_id"]
|
||||||
desc := json["description"]
|
desc := json["description"]
|
||||||
if len(desc) == 0 {
|
if len(desc) == 0 {
|
||||||
c.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
c.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
||||||
@ -319,18 +319,27 @@ func PutUserDesc(c *gin.Context) {
|
|||||||
// @Success 200 {string} string "ok"
|
// @Success 200 {string} string "ok"
|
||||||
// @Router /user/person/info [post]
|
// @Router /user/person/info [post]
|
||||||
func PostUserPersonInfo(c *gin.Context) {
|
func PostUserPersonInfo(c *gin.Context) {
|
||||||
desc := c.PostForm("description")
|
json := make(map[string]string)
|
||||||
nickName := c.PostForm("nick_name")
|
c.BindJSON(&json)
|
||||||
|
desc := json["description"]
|
||||||
|
nickName := json["nick_name"]
|
||||||
|
id := json["user_id"]
|
||||||
if len(desc) == 0 || len(nickName) == 0 {
|
if len(desc) == 0 || len(nickName) == 0 {
|
||||||
c.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
c.JSON(http.StatusOK, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
user := service.MyService.User().GetUserInfoById(id)
|
||||||
|
if user.Id == 0 {
|
||||||
|
c.JSON(http.StatusOK,
|
||||||
|
model.Result{Success: common_err.USER_NOT_EXIST, Message: common_err.GetMsg(common_err.USER_NOT_EXIST)})
|
||||||
|
return
|
||||||
|
}
|
||||||
//user_service.SetUser("", "", "", "", desc, nickName)
|
//user_service.SetUser("", "", "", "", desc, nickName)
|
||||||
data := make(map[string]string, 2)
|
user.NickName = nickName
|
||||||
data["description"] = config.UserInfo.Description
|
user.Description = desc
|
||||||
data["nick_name"] = config.UserInfo.NickName
|
service.MyService.User().UpdateUser(user)
|
||||||
go service.MyService.Casa().PushUserInfo()
|
go service.MyService.Casa().PushUserInfo()
|
||||||
c.JSON(http.StatusOK, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: data})
|
c.JSON(http.StatusOK, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: user})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary get user info
|
// @Summary get user info
|
||||||
|
|||||||
@ -208,9 +208,9 @@ func (c *systemService) GetNet(physics bool) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *systemService) UpdateSystemVersion(version string) {
|
func (s *systemService) UpdateSystemVersion(version string) {
|
||||||
//command2.OnlyExec("curl -fsSL https://get.casaos.io | bash")
|
command2.OnlyExec("curl -fsSL https://raw.githubusercontent.com/IceWhaleTech/get/main/update.sh | bash")
|
||||||
//s.log.Error(config.AppInfo.ProjectPath + "/shell/tool.sh -r " + version)
|
//s.log.Error(config.AppInfo.ProjectPath + "/shell/tool.sh -r " + version)
|
||||||
command2.ExecResultStrArray("source " + config.AppInfo.ShellPath + "/tools.sh ;update " + version)
|
//command2.ExecResultStrArray("source " + config.AppInfo.ShellPath + "/tools.sh ;update " + version)
|
||||||
//s.log.Error(command2.ExecResultStr(config.AppInfo.ProjectPath + "/shell/tool.sh -r " + version))
|
//s.log.Error(command2.ExecResultStr(config.AppInfo.ProjectPath + "/shell/tool.sh -r " + version))
|
||||||
}
|
}
|
||||||
func (s *systemService) UpdateAssist() {
|
func (s *systemService) UpdateAssist() {
|
||||||
|
|||||||
323
shell/assist.sh
323
shell/assist.sh
@ -3,21 +3,326 @@
|
|||||||
# @Author: LinkLeong link@icewhale.com
|
# @Author: LinkLeong link@icewhale.com
|
||||||
# @Date: 2022-02-17 18:53:29
|
# @Date: 2022-02-17 18:53:29
|
||||||
# @LastEditors: LinkLeong
|
# @LastEditors: LinkLeong
|
||||||
# @LastEditTime: 2022-06-29 16:39:22
|
# @LastEditTime: 2022-06-29 17:41:42
|
||||||
# @FilePath: /CasaOS/shell/assist.sh
|
# @FilePath: /CasaOS/shell/assist.sh
|
||||||
# @Description:
|
# @Description:
|
||||||
# @Website: https://www.casaos.io
|
# @Website: https://www.casaos.io
|
||||||
# Copyright (c) 2022 by icewhale, All Rights Reserved.
|
# Copyright (c) 2022 by icewhale, All Rights Reserved.
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((EUID)) && sudo_cmd="sudo"
|
||||||
|
|
||||||
|
# SYSTEM INFO
|
||||||
|
readonly UNAME_M="$(uname -m)"
|
||||||
|
|
||||||
|
# CasaOS PATHS
|
||||||
|
readonly CASA_REPO=LinkLeong/casaos-alpha
|
||||||
|
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}
|
||||||
|
|
||||||
|
if [[ $(systemctl is-active ${CASA_BIN}) == "active" ]]; then
|
||||||
|
${sudo_cmd} systemctl stop ${CASA_BIN}
|
||||||
|
${sudo_cmd} systemctl disable ${CASA_BIN}
|
||||||
|
fi
|
||||||
|
Show 2 "Start cleaning up the old version."
|
||||||
|
if [[ -f "/usr/lib/systemd/system/casaos.service" ]]; then
|
||||||
|
${sudo_cmd} rm -rf /usr/lib/systemd/system/casaos.service
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "/lib/systemd/system/casaos.service" ]]; then
|
||||||
|
${sudo_cmd} rm -rf /lib/systemd/system/casaos.service
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "/usr/local/bin/${CASA_BIN}" ]]; then
|
||||||
|
${sudo_cmd} rm -rf /usr/local/bin/${CASA_BIN}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "/casaOS/server/conf/conf.ini" ]]; then
|
||||||
|
${sudo_cmd} cp -rf /casaOS/server/conf/conf.ini ${CASA_CONF_PATH}
|
||||||
|
${sudo_cmd} cp -rf /casaOS/server/conf/*.json ${CASA_USER_CONF_PATH}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "/casaOS/server/db" ]]; then
|
||||||
|
${sudo_cmd} cp -rf /casaOS/server/db/* ${CASA_DB_PATH}
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Clean
|
||||||
|
if [[ -d "/casaOS" ]]; then
|
||||||
|
${sudo_cmd} rm -rf /casaOS
|
||||||
|
fi
|
||||||
|
Show 0 "Clearance completed."
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# 1 Check Arch
|
||||||
|
Check_Arch() {
|
||||||
|
case $UNAME_M in
|
||||||
|
*aarch64*)
|
||||||
|
Target_Arch="arm64"
|
||||||
|
;;
|
||||||
|
*64*)
|
||||||
|
Target_Arch="amd64"
|
||||||
|
;;
|
||||||
|
*armv7*)
|
||||||
|
Target_Arch="arm-7"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
Show 1 "Aborted, unsupported or unknown architecture: $UNAME_M"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
Show 0 "Your hardware architecture is : $UNAME_M"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check Docker running
|
||||||
|
Check_Docker_Running() {
|
||||||
|
for ((i = 1; i <= 3; i++)); do
|
||||||
|
sleep 3
|
||||||
|
if [[ ! $(systemctl is-active docker &>/dev/null) ]]; then
|
||||||
|
Show 1 "Docker is not running, try to start"
|
||||||
|
${sudo_cmd} systemctl start docker
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#Install Docker
|
||||||
|
Install_Docker() {
|
||||||
|
Show 0 "Docker will be installed automatically."
|
||||||
|
echo -e "${aCOLOUR[2]}\c"
|
||||||
|
curl -fsSL https://get.docker.com | bash
|
||||||
|
echo -e "${COLOUR_RESET}\c"
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
Show 1 "Installation failed, please try again."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
Show 0 "Docker Successfully installed."
|
||||||
|
Check_Docker_Running
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#Download CasaOS Package
|
||||||
|
Download_CasaOS() {
|
||||||
|
Show 2 "Downloading CasaOS for ${Target_OS}/${Target_Arch}..."
|
||||||
|
Net_Getter="curl -fsSLk"
|
||||||
|
Casa_Package="${Target_OS}-${Target_Arch}-casaos${CASA_PACKAGE_EXT}"
|
||||||
|
if [[ ! -n "$version" ]]; then
|
||||||
|
Casa_Tag="$(${Net_Getter} ${CASA_RELEASE_API}/latest | grep -o '"tag_name": ".*"' | sed 's/"//g' | sed 's/tag_name: //g')"
|
||||||
|
elif [[ $version == "pre" ]]; then
|
||||||
|
Casa_Tag="$(${net_getter} ${CASA_RELEASE_API} | grep -o '"tag_name": ".*"' | sed 's/"//g' | sed 's/tag_name: //g' | sed -n '1p')"
|
||||||
|
else
|
||||||
|
Casa_Tag="$version"
|
||||||
|
fi
|
||||||
|
Casa_Package_URL="https://github.com/${CASA_REPO}/releases/download/${Casa_Tag}/${Casa_Package}"
|
||||||
|
echo
|
||||||
|
# Remove Temp File
|
||||||
|
${sudo_cmd} rm -rf "$PREFIX/tmp/${Casa_Package}"
|
||||||
|
# Download Package
|
||||||
|
${Net_Getter} "${Casa_Package_URL}" >"$PREFIX/tmp/${Casa_Package}"
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
Show 1 "Download failed, Please check if your internet connection is working and retry."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
Show 0 "Download successful!"
|
||||||
|
fi
|
||||||
|
#Extract CasaOS Package
|
||||||
|
Show 2 "Extracting..."
|
||||||
|
case "${Casa_Package}" in
|
||||||
|
*.zip) ${sudo_cmd} unzip -o "$PREFIX/tmp/${Casa_Package}" -d "$PREFIX/tmp/" ;;
|
||||||
|
*.tar.gz) ${sudo_cmd} tar -xzf "$PREFIX/tmp/${Casa_Package}" -C "$PREFIX/tmp/" ;;
|
||||||
|
esac
|
||||||
|
#Setting Executable Permissions
|
||||||
|
${sudo_cmd} chmod +x "$PREFIX${CASA_UNZIP_TEMP_FOLDER}/${CASA_BIN}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#Install Addons
|
||||||
|
Install_Addons() {
|
||||||
|
Show 2 "Installing CasaOS Addons"
|
||||||
|
${sudo_cmd} cp -rf "$PREFIX${CASA_UNZIP_TEMP_FOLDER}/shell/11-usb-mount.rules" "/etc/udev/rules.d/"
|
||||||
|
${sudo_cmd} cp -rf "$PREFIX${CASA_UNZIP_TEMP_FOLDER}/shell/usb-mount@.service" "/etc/systemd/system/"
|
||||||
|
sync
|
||||||
|
}
|
||||||
|
|
||||||
|
#Clean Temp Files
|
||||||
|
Clean_Temp_Files() {
|
||||||
|
Show 0 "Clean..."
|
||||||
|
${sudo_cmd} rm -rf "$PREFIX${CASA_UNZIP_TEMP_FOLDER}"
|
||||||
|
sync
|
||||||
|
}
|
||||||
|
|
||||||
|
#Install CasaOS
|
||||||
|
Install_CasaOS() {
|
||||||
|
Show 2 "Installing..."
|
||||||
|
|
||||||
|
# Install Bin
|
||||||
|
${sudo_cmd} mv -f $PREFIX${CASA_UNZIP_TEMP_FOLDER}/${CASA_BIN} ${CASA_BIN_PATH}
|
||||||
|
|
||||||
|
# Install Helper
|
||||||
|
if [[ -d ${CASA_HELPER_PATH} ]]; then
|
||||||
|
${sudo_cmd} rm -rf ${CASA_HELPER_PATH}*
|
||||||
|
fi
|
||||||
|
${sudo_cmd} cp -rf $PREFIX${CASA_UNZIP_TEMP_FOLDER}/shell/* ${CASA_HELPER_PATH}
|
||||||
|
#Setting Executable Permissions
|
||||||
|
${sudo_cmd} chmod +x $PREFIX${CASA_HELPER_PATH}*
|
||||||
|
|
||||||
|
# Install Conf
|
||||||
|
if [[ ! -f ${CASA_CONF_PATH} ]]; then
|
||||||
|
if [[ -f $PREFIX${CASA_UNZIP_TEMP_FOLDER}/conf/conf.ini.sample ]]; then
|
||||||
|
${sudo_cmd} mv -f $PREFIX${CASA_UNZIP_TEMP_FOLDER}/conf/conf.ini.sample ${CASA_CONF_PATH}
|
||||||
|
else
|
||||||
|
${sudo_cmd} mv -f $PREFIX${CASA_UNZIP_TEMP_FOLDER}/conf/conf.conf.sample ${CASA_CONF_PATH}
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
sync
|
||||||
|
|
||||||
|
if [[ ! -x "$(command -v ${CASA_BIN})" ]]; then
|
||||||
|
Show 1 "Installation failed, please try again."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
Show 0 "CasaOS Successfully installed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#Generate Service File
|
||||||
|
Generate_Service() {
|
||||||
|
if [ -f ${CASA_SERVICE_PATH} ]; then
|
||||||
|
Show 2 "Try stop CasaOS system service."
|
||||||
|
# Stop before generation
|
||||||
|
if [[ $(systemctl is-active ${CASA_BIN} &>/dev/null) ]]; then
|
||||||
|
${sudo_cmd} systemctl stop ${CASA_BIN}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
Show 2 "Create system service for CasaOS."
|
||||||
|
|
||||||
|
${sudo_cmd} tee ${CASA_SERVICE_PATH} >/dev/null <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=CasaOS Service
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
LimitNOFILE=15210
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1
|
||||||
|
User=root
|
||||||
|
ExecStart=${CASA_BIN_PATH} -c ${CASA_CONF_PATH}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
Show 0 "CasaOS service Successfully created."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start CasaOS
|
||||||
|
Start_CasaOS() {
|
||||||
|
Show 2 "Create a system startup service for CasaOS."
|
||||||
|
$sudo_cmd systemctl daemon-reload
|
||||||
|
$sudo_cmd systemctl enable ${CASA_BIN}
|
||||||
|
|
||||||
|
Show 2 "Start CasaOS service."
|
||||||
|
$sudo_cmd systemctl start ${CASA_BIN}
|
||||||
|
|
||||||
|
if [[ ! $(systemctl is-active ${CASA_BIN}) == "active" ]]; then
|
||||||
|
Show 1 "Failed to start, please try again."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
Show 0 "Service started successfully."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Check_Arch
|
||||||
|
|
||||||
|
# Step 7: Download CasaOS
|
||||||
|
Check_Exist
|
||||||
|
Download_CasaOS
|
||||||
|
|
||||||
|
# Step 8: Install Addon
|
||||||
|
Install_Addons
|
||||||
|
|
||||||
|
# Step 9: Install CasaOS
|
||||||
|
Install_CasaOS
|
||||||
|
|
||||||
|
# Step 10: Generate_Service
|
||||||
|
Generate_Service
|
||||||
|
|
||||||
|
# Step 11: Start CasaOS
|
||||||
|
Start_CasaOS
|
||||||
|
Clean_Temp_Files
|
||||||
|
|
||||||
version_0_2_11() {
|
version_0_2_11() {
|
||||||
sysctl -w net.core.rmem_max=2500000
|
${sudo_cmd} sysctl -w net.core.rmem_max=2500000
|
||||||
}
|
}
|
||||||
|
|
||||||
mvfoder_version_0_3_3() {
|
version_0_2_11
|
||||||
#移动脚本
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
version_0_2_11
|
|
||||||
mvfoder_version_0_3_3
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
# @Author: LinkLeong link@icewhale.com
|
# @Author: LinkLeong link@icewhale.com
|
||||||
# @Date: 2021-12-06 17:12:32
|
# @Date: 2021-12-06 17:12:32
|
||||||
# @LastEditors: LinkLeong
|
# @LastEditors: LinkLeong
|
||||||
# @LastEditTime: 2022-06-29 16:37:38
|
# @LastEditTime: 2022-06-29 17:45:20
|
||||||
# @FilePath: /CasaOS/shell/tools.sh
|
# @FilePath: /CasaOS/shell/tools.sh
|
||||||
# @Description:
|
# @Description:
|
||||||
# @Website: https://www.casaos.io
|
# @Website: https://www.casaos.io
|
||||||
@ -27,6 +27,5 @@ run_external_script() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
curl -fsSL https://get.icewhale.io | bash
|
|
||||||
run_external_script
|
run_external_script
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user