Skip to content
This repository was archived by the owner on Sep 26, 2024. It is now read-only.

Commit 0e9d92a

Browse files
authored
Merge pull request #152 from thw26/master
Add logos_info() and logos_warn()
2 parents 0d94ded + 27c0b36 commit 0e9d92a

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Changelog
2+
* 3.6.3
3+
- Introduce logos_info() and logos_warn() to simplify script feedback. [T. H. Wright]
24
* 3.6.2
35
- Retrieve Logos release version from XML feed [T. H. Wright]
46
- Modify the script version, and update the CHANGELOG to reflect this change.

LogosLinuxInstaller.sh

+18-14
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ heavy_wineserver_wait() {
9292
}
9393

9494
## BEGIN ZENITY FUNCTIONS
95+
cli_msg() {
96+
printf "%s\n" "${1}"
97+
}
9598
gtk_info() {
9699
zenity --info --width=300 --height=200 --text="$*" --title='Information'
97100
}
@@ -101,18 +104,23 @@ gtk_warn() {
101104
gtk_error() {
102105
zenity --error --width=300 --height=200 --text="$*" --title='Error!'
103106
}
104-
105-
cli_error() {
106-
printf "%s\n" "${1}"
107+
logos_info() {
108+
INFO_MESSAGE="${1}"
109+
cli_msg "${INFO_MESSAGE}"
110+
gtk_info "${INFO_MESSAGE}"
111+
}
112+
logos_warn() {
113+
WARN_MESSAGE="${1}"
114+
cli_msg "${WARN_MESSAGE}"
115+
gtk_warn "${WARN_MESSAGE}"
107116
}
108-
109117
logos_error() {
110118
WIKI_LINK="https://github.com/ferion11/LogosLinuxInstaller/wiki"
111119
TELEGRAM_LINK="https://t.me/linux_logos"
112120
MATRIX_LINK="https://matrix.to/#/#logosbible:matrix.org"
113121
ERROR_MESSAGE="${1}"
114122
HELP_MESSAGE="If you need help, please consult:\n\n${WIKI_LINK}\n${TELEGRAM_LINK}\n${MATRIX_LINK}"
115-
cli_error "${ERROR_MESSAGE}\n\n${HELP_MESSAGE}";
123+
cli_msg "${ERROR_MESSAGE}\n\n${HELP_MESSAGE}";
116124
gtk_error "${ERROR_MESSAGE}\n\n${HELP_MESSAGE}";
117125
kill -SIGKILL "-$(($(ps -o pgid= -p "${$}")))"
118126
exit 1;
@@ -988,33 +996,29 @@ postInstall() {
988996
mkdir -p "${HOME}/.config/Logos_on_Linux";
989997
if [ -d "${HOME/.config/Logos_on_Linux}" ]; then
990998
createConfig;
991-
echo "A config file was created at ${DEFAULT_CONFIG_PATH}.";
992-
gtk_continue_question "A config file was created at ${DEFAULT_CONFIG_PATH}.";
999+
logos_info "A config file was created at ${DEFAULT_CONFIG_PATH}.";
9931000
else
994-
echo "${HOME}/.config/Logos_on_Linux does not exist. Failed to create config file."
995-
gtk_continue_question "${HOME}/.config/Logos_on_Linux does not exist. Failed to create config file."
1001+
logos_warn "${HOME}/.config/Logos_on_Linux does not exist. Failed to create config file."
9961002
fi
9971003
elif [ -z "$LOGOS_CONFIG" ] && [ -f "${DEFAULT_CONFIG_PATH}" ]; then
9981004
if gtk_question "The script found a config file at ${DEFAULT_CONFIG_PATH}. Should the script overwrite the existing config?"; then
9991005
if [ -d "${HOME/.config/Logos_on_Linux}" ]; then
10001006
createConfig;
10011007
else
1002-
echo "${HOME}/.config/Logos_on_Linux does not exist. Failed to create config file.";
1003-
gtk_continue_question "${HOME}/.config/Logos_on_Linux does not exist. Failed to create config file."
1008+
logos_warn "${HOME}/.config/Logos_on_Linux does not exist. Failed to create config file."
10041009
fi
10051010
fi
10061011
else
10071012
# Script was run with a config file. Skip modifying the config.
10081013
:
10091014
fi
10101015

1011-
if gtk_question "A launch script has been placed in ${INSTALLDIR} for your use. The script's name is ${FLPRODUCT}.sh.\n\nDo you want to run it now?\n\nNOTE: There may be an error on first execution. You can close the error dialog."; then
1016+
if logos_info "A launch script has been placed in ${INSTALLDIR} for your use. The script's name is ${FLPRODUCT}.sh.\n\nDo you want to run it now?\n\nNOTE: There may be an error on first execution. You can close the error dialog."; then
10121017
"${INSTALLDIR}"/"${FLPRODUCT}".sh
10131018
else echo "The script has finished. Exiting…";
10141019
fi
10151020
else
1016-
echo "Installation failed. ${LOGOS_EXE} not found. Exiting…"
1017-
logos_error "The ${FLPRODUCT} executable was not found. This means something went wrong while installing ${FLPRODUCT}. Please contact the Logos on Linux community for help."
1021+
logos_error "Installation failed. ${LOGOS_EXE} not found. Exiting…\n\nThe ${FLPRODUCT} executable was not found. This means something went wrong while installing ${FLPRODUCT}. Please contact the Logos on Linux community for help."
10181022
fi
10191023
}
10201024
# END FUNCTION DECLARATIONS

0 commit comments

Comments
 (0)