make reading configuration a separate function
This commit is contained in:
parent
d5e7860fb3
commit
a13a5ab706
1 changed files with 19 additions and 13 deletions
16
snap-pac
16
snap-pac
|
|
@ -23,8 +23,11 @@
|
||||||
|
|
||||||
declare -r prefile_prefix="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
declare -r prefile_prefix="/usr/share/libalpm/hooks.bin/snap-pac/.pre"
|
||||||
|
|
||||||
declare -i i=0
|
function read_configs
|
||||||
for x in $(ls /etc/snapper/configs); do
|
{
|
||||||
|
declare -r pacman_cmd="$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"
|
||||||
|
declare -i i=0
|
||||||
|
for x in $(ls /etc/snapper/configs); do
|
||||||
source /etc/snapper/configs/$x
|
source /etc/snapper/configs/$x
|
||||||
if [[ $x == "root" ]]; then
|
if [[ $x == "root" ]]; then
|
||||||
take_snapshot[i]=${PACMAN_PRE_POST:-"yes"}
|
take_snapshot[i]=${PACMAN_PRE_POST:-"yes"}
|
||||||
|
|
@ -32,13 +35,15 @@ for x in $(ls /etc/snapper/configs); do
|
||||||
take_snapshot[i]=${PACMAN_PRE_POST:-"no"}
|
take_snapshot[i]=${PACMAN_PRE_POST:-"no"}
|
||||||
fi
|
fi
|
||||||
cleanupalgo[i]=${PACMAN_CLEANUP_ALGORITHM:-"number"}
|
cleanupalgo[i]=${PACMAN_CLEANUP_ALGORITHM:-"number"}
|
||||||
pre_description[i]=${PACMAN_PRE_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
pre_description[i]=${PACMAN_PRE_DESCRIPTION:-"$pacman_cmd"}
|
||||||
post_description[i]=${PACMAN_POST_DESCRIPTION:-"$(echo $(ps -C pacman -o args=) | sed 'sX/usr/bin/pacmanXpacmanXg')"}
|
post_description[i]=${PACMAN_POST_DESCRIPTION:-"$pacman_cmd"}
|
||||||
i=$(($i+1))
|
i=$(($i+1))
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function pre
|
function pre
|
||||||
{
|
{
|
||||||
|
read_configs
|
||||||
declare -i i=0
|
declare -i i=0
|
||||||
for x in $(ls /etc/snapper/configs); do
|
for x in $(ls /etc/snapper/configs); do
|
||||||
if [[ ${take_snapshot[i]} == "yes" ]];then
|
if [[ ${take_snapshot[i]} == "yes" ]];then
|
||||||
|
|
@ -50,6 +55,7 @@ function pre
|
||||||
|
|
||||||
function post
|
function post
|
||||||
{
|
{
|
||||||
|
read_configs
|
||||||
declare -i i=0
|
declare -i i=0
|
||||||
for x in $(ls /etc/snapper/configs); do
|
for x in $(ls /etc/snapper/configs); do
|
||||||
if [[ ${take_snapshot[i]} == "yes" ]];then
|
if [[ ${take_snapshot[i]} == "yes" ]];then
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue