Update UPDATE.sh

This commit is contained in:
Stefan Pejcic 2024-08-19 14:11:40 +02:00 committed by GitHub
parent 16851d4b26
commit 41af8ae2da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,7 +89,6 @@ FUNCTIONS=(
#backup /etc/openpanel/ first #backup /etc/openpanel/ first
create_backup_first create_backup_first
# fix for bug with php not autostarting # fix for bug with php not autostarting
php_fix php_fix
@ -464,16 +463,22 @@ update_config_files() {
exit 1 exit 1
fi fi
mkdir -p /tmp/op024/
cp $CONFIG_DIR/mysql/db.cnf /tmp/op024/db.cnf
cp /etc/openpanel/openadmin/users.db /tmp/op024/users.db
cp $CONFIG_DIR/mysql/db.cnf /tmp/op024/db.cnf
cp $CONFIG_DIR/openpanel/conf/openpanel.config /tmp/op024/openpanel.config
rm $CONFIG_DIR/nginx/vhosts/docker_apache_domain.conf rm $CONFIG_DIR/nginx/vhosts/docker_apache_domain.conf
git add . rm $CONFIG_DIR/mysql/db.cnf
rm $CONFIG_DIR/openpanel/conf/openpanel.config
git rm $CONFIG_DIR/mysql/db.cnf
git rm $CONFIG_DIR/openpanel/conf/openpanel.config
git rm $CONFIG_DIR/nginx/vhosts/docker_apache_domain.conf git rm $CONFIG_DIR/nginx/vhosts/docker_apache_domain.conf
# 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."
exit 1
fi
# Pull the latest changes from the remote repository # Pull the latest changes from the remote repository
if ! git pull origin main; then if ! git pull origin main; then
echo "Error: Failed to pull latest changes from the remote repository." echo "Error: Failed to pull latest changes from the remote repository."
@ -482,18 +487,6 @@ update_config_files() {
exit 1 exit 1
fi fi
# Apply the stashed changes
if ! git stash pop; then
echo "Error: Failed to apply stashed changes."
exit 1
fi
# Check for merge conflicts
if git ls-files -u | grep -q '^'; then
echo "Merge conflicts detected. Please resolve conflicts manually."
exit 1
fi
# Move any untracked files to a temporary location # Move any untracked files to a temporary location
mkdir -p "$TEMP_DIR_FOR_GIT" mkdir -p "$TEMP_DIR_FOR_GIT"
for file in $(git ls-files --others --exclude-standard); do for file in $(git ls-files --others --exclude-standard); do
@ -511,7 +504,7 @@ update_config_files() {
mv "$TEMP_DIR_FOR_GIT"/* . 2>/dev/null mv "$TEMP_DIR_FOR_GIT"/* . 2>/dev/null
fi fi
cp /tmp/OPENPANEL024/openadmin/users.db /etc/openpanel/openadmin/users.db cp /tmp/op024/users.db /etc/openpanel/openadmin/users.db
# Clean up temporary files # Clean up temporary files
rm -rf "$TEMP_DIR_FOR_GIT" rm -rf "$TEMP_DIR_FOR_GIT"