mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 05:12:27 +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
|
for helper in ${AUR_HELPERS}; do
|
||||||
if command_exists "${helper}"; then
|
if command_exists "${helper}"; then
|
||||||
AUR_HELPER=${helper}
|
AUR_HELPER=${helper}
|
||||||
echo "Using ${helper} as AUR helper"
|
printf "Using ${helper} as AUR helper"
|
||||||
AUR_HELPER_CHECKED=true
|
AUR_HELPER_CHECKED=true
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
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
|
"$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 /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
|
cd yay-bin && makepkg --noconfirm -si
|
||||||
|
@ -49,7 +49,7 @@ checkEscalationTool() {
|
||||||
for tool in ${ESCALATION_TOOLS}; do
|
for tool in ${ESCALATION_TOOLS}; do
|
||||||
if command_exists "${tool}"; then
|
if command_exists "${tool}"; then
|
||||||
ESCALATION_TOOL=${tool}
|
ESCALATION_TOOL=${tool}
|
||||||
echo "Using ${tool} for privilege escalation"
|
printf "Using ${tool} for privilege escalation"
|
||||||
ESCALATION_TOOL_CHECKED=true
|
ESCALATION_TOOL_CHECKED=true
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -65,7 +65,7 @@ checkCommandRequirements() {
|
||||||
REQUIREMENTS=$1
|
REQUIREMENTS=$1
|
||||||
for req in ${REQUIREMENTS}; do
|
for req in ${REQUIREMENTS}; do
|
||||||
if ! command_exists "${req}"; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -77,7 +77,7 @@ checkPackageManager() {
|
||||||
for pgm in ${PACKAGEMANAGER}; do
|
for pgm in ${PACKAGEMANAGER}; do
|
||||||
if command_exists "${pgm}"; then
|
if command_exists "${pgm}"; then
|
||||||
PACKAGER=${pgm}
|
PACKAGER=${pgm}
|
||||||
echo "Using ${pgm}"
|
printf "Using ${pgm}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -94,14 +94,14 @@ checkSuperUser() {
|
||||||
for sug in ${SUPERUSERGROUP}; do
|
for sug in ${SUPERUSERGROUP}; do
|
||||||
if groups | grep -q "${sug}"; then
|
if groups | grep -q "${sug}"; then
|
||||||
SUGROUP=${sug}
|
SUGROUP=${sug}
|
||||||
echo "Super user group ${SUGROUP}"
|
printf "Super user group ${SUGROUP}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
## Check if member of the sudo group.
|
## Check if member of the sudo group.
|
||||||
if ! groups | grep -q "${SUGROUP}"; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ checkCurrentDirectoryWritable() {
|
||||||
## Check if the current directory is writable.
|
## Check if the current directory is writable.
|
||||||
GITPATH="$(dirname "$(realpath "$0")")"
|
GITPATH="$(dirname "$(realpath "$0")")"
|
||||||
if [ ! -w "$GITPATH" ]; then
|
if [ ! -w "$GITPATH" ]; then
|
||||||
echo "${RED}Can't write to $GITPATH${RC}"
|
printf "%b\n" "${RED}Can't write to $GITPATH${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user