mirror of
https://github.com/bckelley/mybash.git
synced 2026-08-24 03:24:09 -05:00
Revert "Merge remote-tracking branch 'refs/remotes/origin/main'"
This reverts commit4d43d6d26a, reversing changes made to550cbbce97.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
RC='\e[0m'
|
||||
RED='\e[31m'
|
||||
@@ -9,19 +9,27 @@ command_exists() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
## Function to grant sudo permissions to the current user
|
||||
grant_sudo_permissions() {
|
||||
# Prompt for the root password
|
||||
su -c "usermod -aG sudo ${USER}"
|
||||
echo "Sudo permissions granted to user ${USER}"
|
||||
}
|
||||
|
||||
# Check if the user is in the sudo group
|
||||
if id -nG "${USER}" | grep -qw "sudo"; then
|
||||
echo "User ${USER} is already in the sudo group"
|
||||
else
|
||||
grant_sudo_permissions
|
||||
fi
|
||||
|
||||
checkEnv() {
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo -e "${RED}This script must be run as root.${RC}" 1>&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
## Check for requirements.
|
||||
REQUIREMENTS='curl groups sudo'
|
||||
for req in ${REQUIREMENTS}; do
|
||||
if ! command_exists "$req"; then
|
||||
echo -e "${RED}To run me, you need: ${req}${RC}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -37,14 +45,14 @@ checkEnv() {
|
||||
|
||||
if [ -z "${PACKAGER}" ]; then
|
||||
echo -e "${RED}Can't find a supported package manager${RC}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Check if the current directory is writable.
|
||||
GITPATH="$(dirname "$(realpath "$0")")"
|
||||
if [ ! -w "${GITPATH}" ]; then
|
||||
echo -e "${RED}Can't write to ${GITPATH}${RC}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Check SuperUser Group
|
||||
@@ -60,7 +68,7 @@ checkEnv() {
|
||||
## Check if member of the sudo group.
|
||||
if ! groups | grep -q "$SUGROUP"; then
|
||||
echo -e "${RED}You need to be a member of the sudo group to run me!${RC}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -68,7 +76,6 @@ installDepend() {
|
||||
## Check for dependencies.
|
||||
DEPENDENCIES='bash bash-completion tar neovim bat tree multitail fastfetch'
|
||||
echo -e "${YELLOW}Installing dependencies...${RC}"
|
||||
<<<<<<< HEAD
|
||||
if [ "$PACKAGER" = "pacman" ]; then
|
||||
if ! command_exists yay && ! command_exists paru; then
|
||||
echo "Installing yay as AUR helper..."
|
||||
@@ -92,28 +99,6 @@ installDepend() {
|
||||
else
|
||||
sudo "$PACKAGER" install -yq ${DEPENDENCIES}
|
||||
fi
|
||||
=======
|
||||
for pkg in $DEPENDENCIES; do
|
||||
read -p "Would you like to install $pkg package? [Y/n]: " choice
|
||||
case "$choice" in
|
||||
y|Y|'')
|
||||
if [ "$PACKAGER" = "pacman" ]; then
|
||||
sudo "$PACKAGER" -S --noconfirm "$pkg"
|
||||
else
|
||||
sudo "$PACKAGER" install -y "$pkg"
|
||||
fi
|
||||
;;
|
||||
n|N) ;;
|
||||
*) echo "Invalid choice. Defaulting to yes."
|
||||
if [ "$PACKAGER" = "pacman" ]; then
|
||||
sudo "$PACKAGER" -S --noconfirm "$pkg"
|
||||
else
|
||||
sudo "$PACKAGER" install -y "$pkg"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
>>>>>>> refs/remotes/origin/main
|
||||
}
|
||||
|
||||
installOhMyPosh() {
|
||||
@@ -124,7 +109,7 @@ installOhMyPosh() {
|
||||
|
||||
if ! curl -sS https://ohmyposh.dev/install.sh | bash -s; then
|
||||
echo -e "${RED}Something went wrong during oh-my-posh install!${RC}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
|
||||
oh-my-posh font install
|
||||
@@ -145,7 +130,7 @@ installZoxide() {
|
||||
|
||||
if ! curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh; then
|
||||
echo -e "${RED}Something went wrong during zoxide install!${RC}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -155,20 +140,9 @@ installFastfetch() {
|
||||
return
|
||||
fi
|
||||
|
||||
<<<<<<< HEAD
|
||||
if ! curl -sSL https://github.com/fastfetch-cli/fastfetch/releases/download/2.13.2/fastfetch-linux-amd64.deb -o fastfetch-linux-amd64.deb || ! sudo dpkg -i fastfetch-linux-amd64.deb; then
|
||||
echo -e "${RED}Something went wrong during fastfetch install${RC}"
|
||||
exit 1
|
||||
=======
|
||||
echo -e "${YELLOW}Installing fastfetch...${RC}"
|
||||
if [ "$PACKAGER" = "nala" ] || [ "$PACKAGER" = "apt" ]; then
|
||||
if ! curl -sSL https://github.com/fastfetch-cli/fastfetch/releases/download/2.13.2/fastfetch-linux-amd64.deb -o fastfetch-linux-amd64.deb || ! sudo dpkg -i fastfetch-linux-amd64.deb; then
|
||||
echo -e "${RED}Something went wrong during fastfetch install${RC}"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
sudo "$PACKAGER" install -y fastfetch
|
||||
>>>>>>> refs/remotes/origin/main
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -190,7 +164,7 @@ linkConfig() {
|
||||
echo -e "${YELLOW}Moving old bash config file to ${USER_HOME}/.bashrc.bak${RC}"
|
||||
if ! mv "${OLD_BASHRC}" "${USER_HOME}/.bashrc.bak"; then
|
||||
echo -e "${RED}Can't move the old bash config file!${RC}"
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user