refactor(script): Get variables first then define an operation suffix (#1)

This commit is contained in:
hygienic-books 2023-03-07 01:01:20 +01:00
parent 4553bee760
commit ce93c8558e

View File

@ -5,9 +5,6 @@ while read pkg; do
pkgs+=("${pkg}") pkgs+=("${pkg}")
done done
declare operation
operation="${1}"
declare conf_file declare conf_file
conf_file='/etc/pacman-zfs-snapshot.conf' conf_file='/etc/pacman-zfs-snapshot.conf'
@ -37,6 +34,20 @@ declare pkg_separator max_zfs_snapshot_name_length
pkg_separator=':' pkg_separator=':'
max_zfs_snapshot_name_length='255' max_zfs_snapshot_name_length='255'
declare operation conf_op_suffix
operation="${1}"
case "${operation}" in
install)
conf_op_suffix="${snap_op_installation_suffix}"
;;
remove)
conf_op_suffix="${snap_op_remove_suffix}"
;;
upgrade)
conf_op_suffix="${snap_op_upgrade_suffix}"
;;
esac
function pprint () { function pprint () {
local style msg exit_code local style msg exit_code
style="${1:?}" style="${1:?}"