Skip to content

Commit

Permalink
hooks/backup,restore: Fix some shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar committed Dec 18, 2024
1 parent 7807ecf commit b30a680
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 9 deletions.
4 changes: 3 additions & 1 deletion hooks/backup/05-conf_ldap
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
#

# Exit hook on subcommand error or unset variable
set -eu
set -Eeuo pipefail


# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

# Backup destination
Expand Down
3 changes: 2 additions & 1 deletion hooks/backup/17-data_home
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#

# Exit hook on subcommand error or unset variable
set -eu
set -Eeuo pipefail

# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

# Backup destination
Expand Down
3 changes: 2 additions & 1 deletion hooks/backup/18-data_multimedia
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#

# Exit hook on subcommand error or unset variable
set -eu
set -Eeuo pipefail

# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

# Backup destination
Expand Down
3 changes: 2 additions & 1 deletion hooks/backup/20-conf_ynh_settings
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#

# Exit hook on subcommand error or unset variable
set -eu
set -Eeuo pipefail

# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

# Backup destination
Expand Down
3 changes: 2 additions & 1 deletion hooks/backup/21-conf_ynh_certs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#

# Exit hook on subcommand error or unset variable
set -eu
set -Eeuo pipefail

# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

# Backup destination
Expand Down
3 changes: 2 additions & 1 deletion hooks/backup/23-data_mail
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#

# Exit hook on subcommand error or unset variable
set -eu
set -Eeuo pipefail

# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

# Backup destination
Expand Down
5 changes: 5 additions & 0 deletions hooks/backup/50-conf_manually_modified_files
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

set -Eeuo pipefail

# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

ynh_abort_if_errors
YNH_CWD="${YNH_BACKUP_DIR%/}/conf/manually_modified_files"
mkdir -p "$YNH_CWD"
Expand Down
2 changes: 1 addition & 1 deletion hooks/restore/17-data_home
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

backup_dir="$1/data/home"

cp -a $backup_dir/. /home
cp -a "$backup_dir/." /home
1 change: 1 addition & 0 deletions hooks/restore/18-data_multimedia
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
set -eu

# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

backup_dir="data/multimedia"
Expand Down
2 changes: 1 addition & 1 deletion hooks/restore/21-conf_ynh_certs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ backup_dir="$1/conf/ynh/certs"

mkdir -p /etc/yunohost/certs/

cp -a $backup_dir/. /etc/yunohost/certs/
cp -a "$backup_dir/." /etc/yunohost/certs/
2 changes: 1 addition & 1 deletion hooks/restore/23-data_mail
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

backup_dir="$1/data/mail"

cp -a $backup_dir/. /var/mail/ || echo 'No mail found'
cp -a "$backup_dir/." /var/mail/ || echo 'No mail found'
chown -R vmail:mail /var/mail/
3 changes: 3 additions & 0 deletions hooks/restore/50-conf_manually_modified_files
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# Source YNH helpers
# shellcheck source=../../helpers/helpers
source /usr/share/yunohost/helpers

ynh_abort_if_errors
YNH_CWD="${YNH_BACKUP_DIR%/}/conf/manually_modified_files"
cd "$YNH_CWD"
Expand Down

0 comments on commit b30a680

Please sign in to comment.