Fix gitea_backup.sh script

This commit is contained in:
flyingscorpio@clevo 2022-04-11 15:05:40 +02:00
parent 8a766646f0
commit fafe84630f
2 changed files with 6 additions and 4 deletions

View file

@ -34,7 +34,7 @@
- name: Set sudoer permissions to git user
become: true
copy:
content: 'git ALL=(root) NOPASSWD:/bin/systemctl'
content: 'git ALL=(root) NOPASSWD:/usr/bin/systemctl'
dest: /etc/sudoers.d/git
owner: root
group: root
@ -80,7 +80,7 @@
template:
src: app.ini.j2
dest: /etc/gitea/app.ini
owner: root
owner: git
group: git
mode: 0640

View file

@ -61,11 +61,13 @@ do_restore() {
chmod 600 "$zip_file" # Backup has changed permissions, restore them here
echo "Unzipping $zip_file..." && unzip "$zip_file" -d "$zip_dir" && echo " OK."
cd "$zip_dir" || exit 1
chmod 660 "$CONFIG_FILE"
echo -n "Restoring $CONFIG_FILE..." && mv -f app.ini "$CONFIG_FILE" && echo " OK."
chmod 640 "$CONFIG_FILE"
echo -n "Restoring $DATA_DIR..." && mv -f data/* "$DATA_DIR" && echo " OK."
echo -n "Restoring $LOG_DIR..." && mv -f log/* "$LOG_DIR" && echo " OK."
echo -n "Restoring $REPO_DIR..." && mkdir -p "$REPO_DIR" && mv -f repos/* "$REPO_DIR" && echo " OK."
echo -n "Changing ownership..." && chown -R git:git /etc/gitea/conf/app.ini /var/lib/gitea && echo " OK."
echo -n "Changing ownership..." && chown -R git:git "$CONFIG_FILE" /var/lib/gitea && echo " OK."
echo -n "Restoring MySQL database..." && mysql --default-character-set=utf8mb4 -u"$MYSQL_USER" -p"$MYSQL_PW" "$MYSQL_DB" < gitea-db.sql && echo " OK."
restart_service
regenerate_hooks
@ -93,7 +95,7 @@ do_prune() {
regenerate_hooks() {
echo "Regenerating hooks..."
cd "$INSTALL_DIR" || exit 1
./gitea admin regenerate hooks && echo "Done."
./gitea admin regenerate hooks --config "$CONFIG_FILE" && echo "Done."
}
stop_service() {