mirror of
https://github.com/guezoloic/serverconfig.git
synced 2026-01-25 09:34:23 +00:00
feat: add info_print flag
This commit is contained in:
22
install.sh
22
install.sh
@@ -16,7 +16,7 @@ fi
|
||||
|
||||
touch "$LOG" || ISERROR=true
|
||||
if $ISERROR; then
|
||||
info_print "Failed to Create $LOG" 3 false; exit 1
|
||||
info_print "Failed to Create $LOG" $ERROR_FLAG false; exit 1
|
||||
fi
|
||||
|
||||
chmod 644 "$LOG"
|
||||
@@ -31,7 +31,7 @@ info_print "Date : Installation $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
|
||||
|
||||
if $ISERROR; then
|
||||
info_print "Failed to move some scripts to $SCRIPT_FILE, See log $LOG" 3 false; exit 1
|
||||
info_print "Failed to move some scripts to $SCRIPT_FILE, See log $LOG" $ERROR_FLAG false; exit 1
|
||||
fi
|
||||
|
||||
info_print "\n\
|
||||
@@ -45,12 +45,12 @@ for config in config/*; do
|
||||
|
||||
if [ -d "$config" ]; then
|
||||
cp -r "$config" "$ETC_DIR/" \
|
||||
&& { info_print "$ETC_DIR/$filename installed (directory)." 6; } \
|
||||
|| { info_print "$ETC_DIR/$filename failed (directory)." 3; ISERROR=true; }
|
||||
&& { info_print "$ETC_DIR/$filename installed (directory)." $SUCCESS_FLAG; } \
|
||||
|| { info_print "$ETC_DIR/$filename failed (directory)." $ERROR_FLAG; ISERROR=true; }
|
||||
else
|
||||
install -Dm755 "$config" "$ETC_DIR/$filename" \
|
||||
&& { info_print "$ETC_DIR/$filename installed." 6; } \
|
||||
|| { info_print "$ETC_DIR/$filename failed." 3; ISERROR=true; }
|
||||
&& { info_print "$ETC_DIR/$filename installed." $SUCCESS_FLAG; } \
|
||||
|| { info_print "$ETC_DIR/$filename failed." $ERROR_FLAG; ISERROR=true; }
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -65,15 +65,15 @@ info_print "\n\
|
||||
|
||||
for dep in ${INSTALLED_DEP[@]}; do
|
||||
if command -v "$dep" &>/dev/null; then
|
||||
info_print "$dep is installed." 6
|
||||
info_print "$dep is installed." $SUCCESS_FLAG
|
||||
else
|
||||
info_print "$dep is not installed." 3
|
||||
info_print "$dep is not installed." $ERROR_FLAG
|
||||
ISERROR=true
|
||||
fi
|
||||
done
|
||||
|
||||
if $ISERROR; then
|
||||
info_print "Some Dependencies are missing. Please check requirements.txt." 3 false; exit 1
|
||||
info_print "Some Dependencies are missing. Please check requirements.txt." $ERROR_FLAG false; exit 1
|
||||
fi
|
||||
|
||||
info_print "\n\
|
||||
@@ -86,8 +86,8 @@ for scripts in libs/*.sh scripts/*.sh; do
|
||||
output="$SCRIPT_FILE/$scripts"
|
||||
|
||||
install $argument "$scripts" $output -Dm755 \
|
||||
&& { info_print "$output installed." 6; } \
|
||||
|| { info_print "$output failed." 3; ISERROR=true; }
|
||||
&& { info_print "$output installed." $SUCCESS_FLAG; } \
|
||||
|| { info_print "$output failed." $ERROR_FLAG; ISERROR=true; }
|
||||
done
|
||||
|
||||
touch $ENV_FILE
|
||||
|
||||
Reference in New Issue
Block a user