mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-12-23 20:09:44 +00:00
Replace echos with printf and general improvements (#482)
Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com> Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
parent
a151a15f1d
commit
b62b14da31
|
@ -20,13 +20,13 @@ checkAURHelper() {
|
|||
for helper in ${AUR_HELPERS}; do
|
||||
if command_exists "${helper}"; then
|
||||
AUR_HELPER=${helper}
|
||||
echo "Using ${helper} as AUR helper"
|
||||
printf "Using ${helper} as AUR helper"
|
||||
AUR_HELPER_CHECKED=true
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Installing yay as AUR helper..."
|
||||
printf "%b\n" "${YELLOW}Installing yay as AUR helper...${RC}"
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel
|
||||
cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/yay-bin.git && "$ESCALATION_TOOL" chown -R "$USER":"$USER" ./yay-bin
|
||||
cd yay-bin && makepkg --noconfirm -si
|
||||
|
@ -49,7 +49,7 @@ checkEscalationTool() {
|
|||
for tool in ${ESCALATION_TOOLS}; do
|
||||
if command_exists "${tool}"; then
|
||||
ESCALATION_TOOL=${tool}
|
||||
echo "Using ${tool} for privilege escalation"
|
||||
printf "Using ${tool} for privilege escalation"
|
||||
ESCALATION_TOOL_CHECKED=true
|
||||
return 0
|
||||
fi
|
||||
|
@ -65,7 +65,7 @@ checkCommandRequirements() {
|
|||
REQUIREMENTS=$1
|
||||
for req in ${REQUIREMENTS}; do
|
||||
if ! command_exists "${req}"; then
|
||||
echo "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
||||
printf "%b\n" "${RED}To run me, you need: ${REQUIREMENTS}${RC}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
@ -77,7 +77,7 @@ checkPackageManager() {
|
|||
for pgm in ${PACKAGEMANAGER}; do
|
||||
if command_exists "${pgm}"; then
|
||||
PACKAGER=${pgm}
|
||||
echo "Using ${pgm}"
|
||||
printf "Using ${pgm}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
@ -94,14 +94,14 @@ checkSuperUser() {
|
|||
for sug in ${SUPERUSERGROUP}; do
|
||||
if groups | grep -q "${sug}"; then
|
||||
SUGROUP=${sug}
|
||||
echo "Super user group ${SUGROUP}"
|
||||
printf "Super user group ${SUGROUP}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
## Check if member of the sudo group.
|
||||
if ! groups | grep -q "${SUGROUP}"; then
|
||||
echo "${RED}You need to be a member of the sudo group to run me!${RC}"
|
||||
printf "%b\n" "${RED}You need to be a member of the sudo group to run me!${RC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ checkCurrentDirectoryWritable() {
|
|||
## Check if the current directory is writable.
|
||||
GITPATH="$(dirname "$(realpath "$0")")"
|
||||
if [ ! -w "$GITPATH" ]; then
|
||||
echo "${RED}Can't write to $GITPATH${RC}"
|
||||
printf "%b\n" "${RED}Can't write to $GITPATH${RC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user