Deliberately remove a previous venv for the python clients

This commit is contained in:
Daniel Markstedt 2023-11-04 21:21:05 +09:00 committed by Daniel Markstedt
parent 0589a0efad
commit cad3df690e

View File

@ -111,7 +111,15 @@ function sudoCheck() {
function deleteFile() { function deleteFile() {
if sudo test -f "$1/$2"; then if sudo test -f "$1/$2"; then
sudo rm "$1/$2" || exit 1 sudo rm "$1/$2" || exit 1
echo "Deleted $1/$2" echo "Deleted file $1/$2"
fi
}
# Delete dir if it exists
function deleteDir() {
if sudo test -d "$1"; then
sudo rm -rf "$1" || exit 1
echo "Deleted directory $1"
fi fi
} }
@ -229,6 +237,9 @@ function installPiscsiWebInterface() {
deleteFile "$SSL_CERTS_PATH" "rascsi-web.crt" deleteFile "$SSL_CERTS_PATH" "rascsi-web.crt"
deleteFile "$SSL_KEYS_PATH" "rascsi-web.key" deleteFile "$SSL_KEYS_PATH" "rascsi-web.key"
# Deleting previous venv dir, if one exists, to avoid the common issue of broken python dependencies
deleteDir "$WEB_INSTALL_PATH/venv"
if [ -f "$SSL_CERTS_PATH/piscsi-web.crt" ]; then if [ -f "$SSL_CERTS_PATH/piscsi-web.crt" ]; then
echo "SSL certificate $SSL_CERTS_PATH/piscsi-web.crt already exists." echo "SSL certificate $SSL_CERTS_PATH/piscsi-web.crt already exists."
else else
@ -1025,6 +1036,9 @@ function installPiscsiScreen() {
REBOOT=1 REBOOT=1
fi fi
# Deleting previous venv dir, if one exists, to avoid the common issue of broken python dependencies
deleteDir "$OLED_INSTALL_PATH/venv"
echo "Installing the piscsi-oled.service configuration..." echo "Installing the piscsi-oled.service configuration..."
sudo cp -f "$OLED_INSTALL_PATH/service-infra/piscsi-oled.service" "$SYSTEMD_PATH/piscsi-oled.service" sudo cp -f "$OLED_INSTALL_PATH/service-infra/piscsi-oled.service" "$SYSTEMD_PATH/piscsi-oled.service"
sudo sed -i /^ExecStart=/d "$SYSTEMD_PATH/piscsi-oled.service" sudo sed -i /^ExecStart=/d "$SYSTEMD_PATH/piscsi-oled.service"
@ -1129,6 +1143,9 @@ function installPiscsiCtrlBoard() {
fi fi
set -e set -e
# Deleting previous venv dir, if one exists, to avoid the common issue of broken python dependencies
deleteDir "$CTRLBOARD_INSTALL_PATH/venv"
echo "Installing the piscsi-ctrlboard.service configuration..." echo "Installing the piscsi-ctrlboard.service configuration..."
sudo cp -f "$CTRLBOARD_INSTALL_PATH/service-infra/piscsi-ctrlboard.service" "$SYSTEMD_PATH/piscsi-ctrlboard.service" sudo cp -f "$CTRLBOARD_INSTALL_PATH/service-infra/piscsi-ctrlboard.service" "$SYSTEMD_PATH/piscsi-ctrlboard.service"
sudo sed -i /^ExecStart=/d "$SYSTEMD_PATH/piscsi-ctrlboard.service" sudo sed -i /^ExecStart=/d "$SYSTEMD_PATH/piscsi-ctrlboard.service"
@ -1223,7 +1240,7 @@ function runChoice() {
compilePiscsi compilePiscsi
backupPiscsiService backupPiscsiService
installPiscsi installPiscsi
configurePiscsiService configurePiscsiService
enablePiscsiService enablePiscsiService
preparePythonCommon preparePythonCommon
if [[ $(isPiscsiScreenInstalled) -eq 0 ]]; then if [[ $(isPiscsiScreenInstalled) -eq 0 ]]; then
@ -1266,7 +1283,7 @@ function runChoice() {
backupPiscsiService backupPiscsiService
preparePythonCommon preparePythonCommon
installPiscsi installPiscsi
configurePiscsiService configurePiscsiService
enablePiscsiService enablePiscsiService
if [[ $(isPiscsiScreenInstalled) -eq 0 ]]; then if [[ $(isPiscsiScreenInstalled) -eq 0 ]]; then
echo "Detected piscsi oled service; will run the installation steps for the OLED monitor." echo "Detected piscsi oled service; will run the installation steps for the OLED monitor."
@ -1454,7 +1471,7 @@ function runChoice() {
fetchHardDiskDrivers fetchHardDiskDrivers
compilePiscsi compilePiscsi
installPiscsi installPiscsi
configurePiscsiService configurePiscsiService
enablePiscsiService enablePiscsiService
preparePythonCommon preparePythonCommon
cachePipPackages cachePipPackages