Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build/sysroot/usr/lib/systemd/system/casaos.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Description=CasaOS Main Service

[Service]
ExecStart=/usr/bin/casaos -c /etc/casaos/casaos.conf
PIDFile=/var/run/casaos/casaos.pid
PIDFile=/run/casaos/casaos.pid
Restart=always
RuntimeDirectory=casaos
Type=notify

[Install]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

readonly CASA_EXEC=casaos
readonly CASA_CONF=/etc/casaos/casaos.conf
readonly CASA_URL=/var/run/casaos/casaos.url
readonly CASA_URL=/run/casaos/casaos.url
readonly CASA_SERVICE_USR=/usr/lib/systemd/system/casaos.service
readonly CASA_SERVICE_LIB=/lib/systemd/system/casaos.service
readonly CASA_SERVICE_ETC=/etc/systemd/system/casaos.service
Expand All @@ -26,33 +26,33 @@
'\e[33m' # Yellow | Emphasis
)

Show() {

Check warning on line 29 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Show' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgF&open=AZ8KCHxORkUNdvVm3CgF&pullRequest=2525
# OK
if (($1 == 0)); then

Check warning on line 31 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgG&open=AZ8KCHxORkUNdvVm3CgG&pullRequest=2525
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} OK $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"

Check warning on line 32 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgH&open=AZ8KCHxORkUNdvVm3CgH&pullRequest=2525
# FAILED
elif (($1 == 1)); then

Check warning on line 34 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgI&open=AZ8KCHxORkUNdvVm3CgI&pullRequest=2525
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[3]}FAILED$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"

Check warning on line 35 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgJ&open=AZ8KCHxORkUNdvVm3CgJ&pullRequest=2525
# INFO
elif (($1 == 2)); then

Check warning on line 37 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgK&open=AZ8KCHxORkUNdvVm3CgK&pullRequest=2525
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} INFO $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"

Check warning on line 38 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgL&open=AZ8KCHxORkUNdvVm3CgL&pullRequest=2525
# NOTICE
elif (($1 == 3)); then

Check warning on line 40 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgM&open=AZ8KCHxORkUNdvVm3CgM&pullRequest=2525
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[4]}NOTICE$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"

Check warning on line 41 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgN&open=AZ8KCHxORkUNdvVm3CgN&pullRequest=2525
fi
}

Warn() {

Check warning on line 45 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Warn' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgO&open=AZ8KCHxORkUNdvVm3CgO&pullRequest=2525
echo -e "${aCOLOUR[3]}$1$COLOUR_RESET"

Check warning on line 46 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgP&open=AZ8KCHxORkUNdvVm3CgP&pullRequest=2525
}

trap 'onCtrlC' INT
onCtrlC() {

Check warning on line 50 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'onCtrlC' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgQ&open=AZ8KCHxORkUNdvVm3CgQ&pullRequest=2525
echo -e "${COLOUR_RESET}"
exit 1
}

Detecting_CasaOS() {

Check warning on line 55 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Detecting_CasaOS' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgR&open=AZ8KCHxORkUNdvVm3CgR&pullRequest=2525
if [[ ! -x "$(command -v ${CASA_EXEC})" ]]; then
Show 2 "CasaOS is not detected, exit the script."
exit 1
Expand All @@ -61,7 +61,7 @@
fi
}

Uninstall_Container() {

Check warning on line 64 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Uninstall_Container' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgS&open=AZ8KCHxORkUNdvVm3CgS&pullRequest=2525
if [[ ${UNINSTALL_ALL_CONTAINER} == true && "$(docker ps -aq)" != "" ]]; then
Show 2 "Start deleting containers."
docker stop "$(docker ps -aq)" || Show 1 "Failed to stop all containers."
Expand All @@ -69,7 +69,7 @@
fi
}

Remove_Images() {

Check warning on line 72 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Remove_Images' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgT&open=AZ8KCHxORkUNdvVm3CgT&pullRequest=2525
if [[ ${REMOVE_IMAGES} == "all" && "$(docker images -q)" != "" ]]; then
Show 2 "Start deleting all images."
docker rmi "$(docker images -q)" || Show 1 "Failed to delete all images."
Expand All @@ -80,7 +80,7 @@
}


Uninstall_Casaos() {

Check warning on line 83 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Uninstall_Casaos' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgU&open=AZ8KCHxORkUNdvVm3CgU&pullRequest=2525

for SERVICE in "${CASA_SERVICES[@]}"; do
Show 2 "Stopping ${SERVICE}..."
Expand Down Expand Up @@ -193,7 +193,7 @@
break
;;
*)
Warn " Invalid input..."

Check warning on line 196 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/arch/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal ' Invalid input...' 4 times.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHxORkUNdvVm3CgV&open=AZ8KCHxORkUNdvVm3CgV&pullRequest=2525
;;
esac
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

readonly CASA_EXEC=casaos
readonly CASA_CONF=/etc/casaos/casaos.conf
readonly CASA_URL=/var/run/casaos/casaos.url
readonly CASA_URL=/run/casaos/casaos.url
readonly CASA_SERVICE_USR=/usr/lib/systemd/system/casaos.service
readonly CASA_SERVICE_LIB=/lib/systemd/system/casaos.service
readonly CASA_SERVICE_ETC=/etc/systemd/system/casaos.service
Expand All @@ -26,33 +26,33 @@
'\e[33m' # Yellow | Emphasis
)

Show() {

Check warning on line 29 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Show' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf0&open=AZ8KCHvORkUNdvVm3Cf0&pullRequest=2525
# OK
if (($1 == 0)); then

Check warning on line 31 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf1&open=AZ8KCHvORkUNdvVm3Cf1&pullRequest=2525
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} OK $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"

Check warning on line 32 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf2&open=AZ8KCHvORkUNdvVm3Cf2&pullRequest=2525
# FAILED
elif (($1 == 1)); then

Check warning on line 34 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf3&open=AZ8KCHvORkUNdvVm3Cf3&pullRequest=2525
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[3]}FAILED$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"

Check warning on line 35 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf4&open=AZ8KCHvORkUNdvVm3Cf4&pullRequest=2525
# INFO
elif (($1 == 2)); then

Check warning on line 37 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf5&open=AZ8KCHvORkUNdvVm3Cf5&pullRequest=2525
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[0]} INFO $COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"

Check warning on line 38 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf6&open=AZ8KCHvORkUNdvVm3Cf6&pullRequest=2525
# NOTICE
elif (($1 == 3)); then

Check warning on line 40 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf7&open=AZ8KCHvORkUNdvVm3Cf7&pullRequest=2525
echo -e "${aCOLOUR[2]}[$COLOUR_RESET${aCOLOUR[4]}NOTICE$COLOUR_RESET${aCOLOUR[2]}]$COLOUR_RESET $2"

Check warning on line 41 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf8&open=AZ8KCHvORkUNdvVm3Cf8&pullRequest=2525
fi
}

Warn() {

Check warning on line 45 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Warn' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf9&open=AZ8KCHvORkUNdvVm3Cf9&pullRequest=2525
echo -e "${aCOLOUR[3]}$1$COLOUR_RESET"

Check warning on line 46 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf-&open=AZ8KCHvORkUNdvVm3Cf-&pullRequest=2525
}

trap 'onCtrlC' INT
onCtrlC() {

Check warning on line 50 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'onCtrlC' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3Cf_&open=AZ8KCHvORkUNdvVm3Cf_&pullRequest=2525
echo -e "${COLOUR_RESET}"
exit 1
}

Detecting_CasaOS() {

Check warning on line 55 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Detecting_CasaOS' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3CgA&open=AZ8KCHvORkUNdvVm3CgA&pullRequest=2525
if [[ ! -x "$(command -v ${CASA_EXEC})" ]]; then
Show 2 "CasaOS is not detected, exit the script."
exit 1
Expand All @@ -61,7 +61,7 @@
fi
}

Uninstall_Container() {

Check warning on line 64 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Uninstall_Container' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3CgB&open=AZ8KCHvORkUNdvVm3CgB&pullRequest=2525
if [[ ${UNINSTALL_ALL_CONTAINER} == true && "$(docker ps -aq)" != "" ]]; then
Show 2 "Start deleting containers."
docker stop "$(docker ps -aq)" || Show 1 "Failed to stop all containers."
Expand All @@ -69,7 +69,7 @@
fi
}

Remove_Images() {

Check warning on line 72 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Remove_Images' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3CgC&open=AZ8KCHvORkUNdvVm3CgC&pullRequest=2525
if [[ ${REMOVE_IMAGES} == "all" && "$(docker images -q)" != "" ]]; then
Show 2 "Start deleting all images."
docker rmi "$(docker images -q)" || Show 1 "Failed to delete all images."
Expand All @@ -80,7 +80,7 @@
}


Uninstall_Casaos() {

Check warning on line 83 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Function 'Uninstall_Casaos' should be named in snake case.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3CgD&open=AZ8KCHvORkUNdvVm3CgD&pullRequest=2525

for SERVICE in "${CASA_SERVICES[@]}"; do
Show 2 "Stopping ${SERVICE}..."
Expand Down Expand Up @@ -193,7 +193,7 @@
break
;;
*)
Warn " Invalid input..."

Check warning on line 196 in build/sysroot/usr/share/casaos/cleanup/service.d/casaos/debian/cleanup-casaos.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal ' Invalid input...' 4 times.

See more on https://sonarcloud.io/project/issues?id=IceWhaleTech_CasaOS&issues=AZ8KCHvORkUNdvVm3CgE&open=AZ8KCHvORkUNdvVm3CgE&pullRequest=2525
;;
esac
done
Expand Down