Update UPDATE.sh

This commit is contained in:
Stefan Pejcic 2024-08-19 13:18:26 +02:00 committed by GitHub
parent 3f782f0101
commit 4fd3c67db3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -427,6 +427,9 @@ done
}
update_config_files() {
echo ""
echo "Downloading latest OpenPanel configuration from https://github.com/stefanpejcic/openpanel-configuration"
@ -438,12 +441,16 @@ update_config_files() {
DOCKER_COMPOSE_SRC="/etc/openpanel/docker/compose/new-docker-compose.yml"
DOCKER_COMPOSE_DEST="/root/docker-compose.yml"
# Navigate to the OpenPanel configuration directory
if ! cd "$CONFIG_DIR"; then
echo "Error: Directory $CONFIG_DIR does not exist."
exit 1
fi
rm $CONFIG_DIR/nginx/vhosts/docker_apache_domain.conf
git add .
# Stash local changes and note if stashing was successful
if ! git stash push -m "Stash before update"; then
echo "Error: Failed to stash local changes."
@ -472,7 +479,9 @@ update_config_files() {
# Move any untracked files to a temporary location
mkdir -p "$TEMP_DIR"
mv bind9/named.conf.default-zones bind9/named.conf.local "$TEMP_DIR/" 2>/dev/null
for file in $(git ls-files --others --exclude-standard); do
mv "$file" "$TEMP_DIR/"
done
# Copy the new Docker Compose file to the root directory
if ! cp "$DOCKER_COMPOSE_SRC" "$DOCKER_COMPOSE_DEST"; then
@ -482,7 +491,7 @@ update_config_files() {
# Move untracked files back if they exist
if [ "$(ls -A $TEMP_DIR)" ]; then
mv "$TEMP_DIR"/* bind9/ 2>/dev/null
mv "$TEMP_DIR"/* . 2>/dev/null
fi
# Clean up temporary files
@ -493,7 +502,6 @@ update_config_files() {
download_new_panel() {
mkdir -p $OPENPANEL_DIR