This commit is contained in:
Brian Zalewski 2023-11-13 06:32:18 +00:00
parent f3b19beb18
commit dda72198ff
7 changed files with 68 additions and 19 deletions

View file

@ -53,6 +53,7 @@ fi
### System upgrade on macOS ### System upgrade on macOS
if [ -d /Applications ] && [ -d /Library ] && [ -z "$NO_RESTART" ]; then if [ -d /Applications ] && [ -d /Library ] && [ -z "$NO_RESTART" ]; then
echo 'bash <(curl -sSL https://install.doctor/start) # TEMPORARY FOR INSTALL DOCTOR MACOS' >> "$HOME/.zshrc"
if command -v gtimeout > /dev/null; then if command -v gtimeout > /dev/null; then
# Allow 8 minutes for system updates # Allow 8 minutes for system updates
logg info 'Ensuring system software is upgraded (timing out after 50 minutes if system upgrade fails)' logg info 'Ensuring system software is upgraded (timing out after 50 minutes if system upgrade fails)'
@ -60,9 +61,14 @@ if [ -d /Applications ] && [ -d /Library ] && [ -z "$NO_RESTART" ]; then
else else
# If gtimeout is unavailable, then attempt system upgrade without a timeout (which usually works on fresh systems) # If gtimeout is unavailable, then attempt system upgrade without a timeout (which usually works on fresh systems)
logg info 'Applying OS upgrades (if available)' logg info 'Applying OS upgrades (if available)'
sudo softwareupdate -i -a -R || logg error 'Failed to perform a system update via sudo softwareupdate -i -a' sudo softwareupdate -i -a -R || logg error 'Failed to perform a system update via sudo softwareupdate -i -a -R'
fi fi
logg info 'If system updates were downloaded / installed, a reboot might be required.' logg info 'If system updates were downloaded / installed, a reboot might be required.'
if command -v gsed > /dev/null; then
sudo gsed -i '/# TEMPORARY FOR INSTALL DOCTOR MACOS/d' "$HOME/.zshrc" || logg warn "Failed to remove kickstart script from .zshrc"
else
sudo sed -i '/# TEMPORARY FOR INSTALL DOCTOR MACOS/d' "$HOME/.zshrc" || logg warn "Failed to remove kickstart script from .zshrc"
fi
fi fi
### Ensure dependencies are installed on Linux ### Ensure dependencies are installed on Linux

View file

@ -106,27 +106,32 @@ logg() {
fi fi
} }
# @description Ensure dependencies like `git` and `curl` are installed (among a few other lightweight system packages) # @description Ensure dependencies like `git` and `curl` are installed (among a few other lightweight system packages)
if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v expect > /dev/null || ! command -v rsync > /dev/null || ! command -v unbuffer; then if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v expect > /dev/null || ! command -v rsync > /dev/null || ! command -v unbuffer; then
if command -v apt-get > /dev/null; then if command -v apt-get > /dev/null; then
### Debian / Ubuntu ### Debian / Ubuntu
logg info 'Running sudo apt-get update' && sudo apt-get update logg info 'Running sudo apt-get update' && sudo apt-get update
logg info 'Running sudo apt-get install -y build-essential curl expect git rsync' && sudo apt-get install -y build-essential curl expect git rsync logg info 'Running sudo apt-get install -y build-essential curl expect git rsync procps file' && sudo apt-get install -y build-essential curl expect git rsync procps file
elif command -v dnf > /dev/null; then elif command -v dnf > /dev/null; then
### Fedora ### Fedora
logg info 'Running sudo dnf install -y curl expect git rsync' && sudo dnf install -y curl expect git rsync logg info 'Running sudo dnf groupinstall -y \'Development Tools\'' && sudo dnf groupinstall -y 'Development Tools'
logg info 'Running sudo dnf install -y curl expect git rsync procps-ng file' && sudo dnf install -y curl expect git rsync procps-ng file
elif command -v yum > /dev/null; then elif command -v yum > /dev/null; then
### CentOS ### CentOS
logg info 'Running sudo yum install -y curl expect git rsync' && sudo yum install -y curl expect git rsync logg info 'Running sudo yum groupinstall -y \'Development Tools\'' && sudo yum groupinstall -y 'Development Tools'
logg info 'Running sudo yum install -y curl expect git rsync procps-ng file' && sudo yum install -y curl expect git rsync procps-ng file
elif command -v pacman > /dev/null; then elif command -v pacman > /dev/null; then
### Archlinux ### Archlinux
logg info 'Running sudo pacman update' && sudo pacman update logg info 'Running sudo pacman update' && sudo pacman update
logg info 'Running sudo pacman -Syu base-devel curl expect git rsync procps-ng file' && sudo pacman -Syu base-devel curl expect git rsync procps-ng file logg info 'Running sudo pacman -Syu base-devel curl expect git rsync procps-ng file' && sudo pacman -Syu base-devel curl expect git rsync procps-ng file
elif command -v zypper > /dev/null; then elif command -v zypper > /dev/null; then
### OpenSUSE ### OpenSUSE
logg info 'Running sudo zypper install -y curl expect git rsync' && sudo zypper install -y curl expect git rsync logg info 'Running sudo zypper install -yt pattern devel_basis' && sudo zypper install -yt pattern devel_basis
logg info 'Running sudo zypper install -y curl expect git rsync procps file' && sudo zypper install -y curl expect git rsync procps file
elif command -v apk > /dev/null; then elif command -v apk > /dev/null; then
### Alpine ### Alpine
logg info 'Running apk add curl expect git rsync' && apk add curl expect git rsync logg info 'Running apk add build-base curl expect git rsync procps file' && apk add build-base curl expect git rsync procps file
elif [ -d /Applications ] && [ -d /Library ]; then elif [ -d /Applications ] && [ -d /Library ]; then
### macOS ### macOS
logg info "Ensuring Xcode Command Line Tools are installed.." logg info "Ensuring Xcode Command Line Tools are installed.."
@ -161,6 +166,11 @@ if ! command -v brew > /dev/null; then
if ! command -v brew > /dev/null; then if ! command -v brew > /dev/null; then
logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1 logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1
fi fi
elif [ -d "$HOME/.linuxbrew" ]; then
logg info "Sourcing from $HOME/.linuxbrew/bin/brew" && eval "$($HOME/.linuxbrew/bin/brew shellenv)"
if ! command -v brew > /dev/null; then
logg error "The $HOME/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1
fi
else else
### Installs Homebrew and addresses a couple potential issues ### Installs Homebrew and addresses a couple potential issues
if command -v sudo > /dev/null && sudo -n true; then if command -v sudo > /dev/null && sudo -n true; then

View file

@ -17,6 +17,11 @@ if ! command -v brew > /dev/null; then
if ! command -v brew > /dev/null; then if ! command -v brew > /dev/null; then
logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1 logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1
fi fi
elif [ -d "$HOME/.linuxbrew" ]; then
logg info "Sourcing from $HOME/.linuxbrew/bin/brew" && eval "$($HOME/.linuxbrew/bin/brew shellenv)"
if ! command -v brew > /dev/null; then
logg error "The $HOME/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1
fi
else else
### Installs Homebrew and addresses a couple potential issues ### Installs Homebrew and addresses a couple potential issues
if command -v sudo > /dev/null && sudo -n true; then if command -v sudo > /dev/null && sudo -n true; then

View file

@ -1,24 +1,29 @@
if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v expect > /dev/null || ! command -v rsync > /dev/null || ! command -v unbuffer; then if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v expect > /dev/null || ! command -v rsync > /dev/null || ! command -v unbuffer; then
if command -v apt-get > /dev/null; then if command -v apt-get > /dev/null; then
### Debian / Ubuntu ### Debian / Ubuntu
logg info 'Running sudo apt-get update' && sudo apt-get update logg info 'Running sudo apt-get update' && sudo apt-get update
logg info 'Running sudo apt-get install -y build-essential curl expect git rsync' && sudo apt-get install -y build-essential curl expect git rsync logg info 'Running sudo apt-get install -y build-essential curl expect git rsync procps file' && sudo apt-get install -y build-essential curl expect git rsync procps file
elif command -v dnf > /dev/null; then elif command -v dnf > /dev/null; then
### Fedora ### Fedora
logg info 'Running sudo dnf install -y curl expect git rsync' && sudo dnf install -y curl expect git rsync logg info 'Running sudo dnf groupinstall -y \'Development Tools\'' && sudo dnf groupinstall -y 'Development Tools'
logg info 'Running sudo dnf install -y curl expect git rsync procps-ng file' && sudo dnf install -y curl expect git rsync procps-ng file
elif command -v yum > /dev/null; then elif command -v yum > /dev/null; then
### CentOS ### CentOS
logg info 'Running sudo yum install -y curl expect git rsync' && sudo yum install -y curl expect git rsync logg info 'Running sudo yum groupinstall -y \'Development Tools\'' && sudo yum groupinstall -y 'Development Tools'
logg info 'Running sudo yum install -y curl expect git rsync procps-ng file' && sudo yum install -y curl expect git rsync procps-ng file
elif command -v pacman > /dev/null; then elif command -v pacman > /dev/null; then
### Archlinux ### Archlinux
logg info 'Running sudo pacman update' && sudo pacman update logg info 'Running sudo pacman update' && sudo pacman update
logg info 'Running sudo pacman -Syu base-devel curl expect git rsync procps-ng file' && sudo pacman -Syu base-devel curl expect git rsync procps-ng file logg info 'Running sudo pacman -Syu base-devel curl expect git rsync procps-ng file' && sudo pacman -Syu base-devel curl expect git rsync procps-ng file
elif command -v zypper > /dev/null; then elif command -v zypper > /dev/null; then
### OpenSUSE ### OpenSUSE
logg info 'Running sudo zypper install -y curl expect git rsync' && sudo zypper install -y curl expect git rsync logg info 'Running sudo zypper install -yt pattern devel_basis' && sudo zypper install -yt pattern devel_basis
logg info 'Running sudo zypper install -y curl expect git rsync procps file' && sudo zypper install -y curl expect git rsync procps file
elif command -v apk > /dev/null; then elif command -v apk > /dev/null; then
### Alpine ### Alpine
logg info 'Running apk add curl expect git rsync' && apk add curl expect git rsync logg info 'Running apk add build-base curl expect git rsync procps file' && apk add build-base curl expect git rsync procps file
elif [ -d /Applications ] && [ -d /Library ]; then elif [ -d /Applications ] && [ -d /Library ]; then
### macOS ### macOS
logg info "Ensuring Xcode Command Line Tools are installed.." logg info "Ensuring Xcode Command Line Tools are installed.."

View file

@ -4,6 +4,11 @@ if ! command -v brew > /dev/null; then
if ! command -v brew > /dev/null; then if ! command -v brew > /dev/null; then
logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1 logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1
fi fi
elif [ -d "$HOME/.linuxbrew" ]; then
logg info "Sourcing from $HOME/.linuxbrew/bin/brew" && eval "$($HOME/.linuxbrew/bin/brew shellenv)"
if ! command -v brew > /dev/null; then
logg error "The $HOME/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1
fi
else else
### Installs Homebrew and addresses a couple potential issues ### Installs Homebrew and addresses a couple potential issues
if command -v sudo > /dev/null && sudo -n true; then if command -v sudo > /dev/null && sudo -n true; then

View file

@ -119,6 +119,7 @@ logg() {
# otherwise use the master Install Doctor branch # otherwise use the master Install Doctor branch
setEnvironmentVariables() { setEnvironmentVariables() {
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
export HOMEBREW_NO_ENV_HINTS=true
if [ -z "$START_REPO" ] && [ -z "$REPO" ]; then if [ -z "$START_REPO" ] && [ -z "$REPO" ]; then
export START_REPO="https://github.com/megabyte-labs/install.doctor.git" export START_REPO="https://github.com/megabyte-labs/install.doctor.git"
else else
@ -140,27 +141,32 @@ setEnvironmentVariables() {
# @description Ensure dependencies like `git` and `curl` are installed (among a few other lightweight system packages) # @description Ensure dependencies like `git` and `curl` are installed (among a few other lightweight system packages)
ensureBasicDeps() { ensureBasicDeps() {
if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v expect > /dev/null || ! command -v rsync > /dev/null || ! command -v unbuffer; then
if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v expect > /dev/null || ! command -v rsync > /dev/null || ! command -v unbuffer; then
if command -v apt-get > /dev/null; then if command -v apt-get > /dev/null; then
### Debian / Ubuntu ### Debian / Ubuntu
logg info 'Running sudo apt-get update' && sudo apt-get update logg info 'Running sudo apt-get update' && sudo apt-get update
logg info 'Running sudo apt-get install -y build-essential curl expect git rsync' && sudo apt-get install -y build-essential curl expect git rsync logg info 'Running sudo apt-get install -y build-essential curl expect git rsync procps file' && sudo apt-get install -y build-essential curl expect git rsync procps file
elif command -v dnf > /dev/null; then elif command -v dnf > /dev/null; then
### Fedora ### Fedora
logg info 'Running sudo dnf install -y curl expect git rsync' && sudo dnf install -y curl expect git rsync logg info 'Running sudo dnf groupinstall -y \'Development Tools\'' && sudo dnf groupinstall -y 'Development Tools'
logg info 'Running sudo dnf install -y curl expect git rsync procps-ng file' && sudo dnf install -y curl expect git rsync procps-ng file
elif command -v yum > /dev/null; then elif command -v yum > /dev/null; then
### CentOS ### CentOS
logg info 'Running sudo yum install -y curl expect git rsync' && sudo yum install -y curl expect git rsync logg info 'Running sudo yum groupinstall -y \'Development Tools\'' && sudo yum groupinstall -y 'Development Tools'
logg info 'Running sudo yum install -y curl expect git rsync procps-ng file' && sudo yum install -y curl expect git rsync procps-ng file
elif command -v pacman > /dev/null; then elif command -v pacman > /dev/null; then
### Archlinux ### Archlinux
logg info 'Running sudo pacman update' && sudo pacman update logg info 'Running sudo pacman update' && sudo pacman update
logg info 'Running sudo pacman -Syu base-devel curl expect git rsync procps-ng file' && sudo pacman -Syu base-devel curl expect git rsync procps-ng file logg info 'Running sudo pacman -Syu base-devel curl expect git rsync procps-ng file' && sudo pacman -Syu base-devel curl expect git rsync procps-ng file
elif command -v zypper > /dev/null; then elif command -v zypper > /dev/null; then
### OpenSUSE ### OpenSUSE
logg info 'Running sudo zypper install -y curl expect git rsync' && sudo zypper install -y curl expect git rsync logg info 'Running sudo zypper install -yt pattern devel_basis' && sudo zypper install -yt pattern devel_basis
logg info 'Running sudo zypper install -y curl expect git rsync procps file' && sudo zypper install -y curl expect git rsync procps file
elif command -v apk > /dev/null; then elif command -v apk > /dev/null; then
### Alpine ### Alpine
logg info 'Running apk add curl expect git rsync' && apk add curl expect git rsync logg info 'Running apk add build-base curl expect git rsync procps file' && apk add build-base curl expect git rsync procps file
elif [ -d /Applications ] && [ -d /Library ]; then elif [ -d /Applications ] && [ -d /Library ]; then
### macOS ### macOS
logg info "Ensuring Xcode Command Line Tools are installed.." logg info "Ensuring Xcode Command Line Tools are installed.."
@ -198,6 +204,11 @@ ensureHomebrew() {
if ! command -v brew > /dev/null; then if ! command -v brew > /dev/null; then
logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1 logg error "The /home/linuxbrew/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1
fi fi
elif [ -d "$HOME/.linuxbrew" ]; then
logg info "Sourcing from $HOME/.linuxbrew/bin/brew" && eval "$($HOME/.linuxbrew/bin/brew shellenv)"
if ! command -v brew > /dev/null; then
logg error "The $HOME/.linuxbrew directory exists but something is not right. Try removing it and running the script again." && exit 1
fi
else else
### Installs Homebrew and addresses a couple potential issues ### Installs Homebrew and addresses a couple potential issues
if command -v sudo > /dev/null && sudo -n true; then if command -v sudo > /dev/null && sudo -n true; then
@ -398,7 +409,7 @@ installBrewPackage() {
# #
# 1. Ensures Chezmoi, Node.js, and ZX are installed. # 1. Ensures Chezmoi, Node.js, and ZX are installed.
# 2. Installs Glow and Gum if the `HEADLESS_INSTALL` environment variable is not set. # 2. Installs Glow and Gum if the `HEADLESS_INSTALL` environment variable is not set.
# 3. If the system is macOS, then also install `gsed`. # 3. If the system is macOS, then also install `gsed` and `coreutils`.
ensureHomebrewDeps() { ensureHomebrewDeps() {
### TUI experience ### TUI experience
if [ -z "$HEADLESS_INSTALL" ]; then if [ -z "$HEADLESS_INSTALL" ]; then
@ -414,6 +425,9 @@ ensureHomebrewDeps() {
### macOS ### macOS
if [ -d /Applications ] && [ -d /System ]; then if [ -d /Applications ] && [ -d /System ]; then
installBrewPackage "gsed" installBrewPackage "gsed"
if ! command -v gtimeout > /dev/null; then
brew install coreutils
fi
fi fi
} }

View file

@ -58,6 +58,7 @@
# otherwise use the master Install Doctor branch # otherwise use the master Install Doctor branch
setEnvironmentVariables() { setEnvironmentVariables() {
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
export HOMEBREW_NO_ENV_HINTS=true
if [ -z "$START_REPO" ] && [ -z "$REPO" ]; then if [ -z "$START_REPO" ] && [ -z "$REPO" ]; then
export START_REPO="https://github.com/megabyte-labs/install.doctor.git" export START_REPO="https://github.com/megabyte-labs/install.doctor.git"
else else
@ -246,7 +247,7 @@ installBrewPackage() {
# #
# 1. Ensures Chezmoi, Node.js, and ZX are installed. # 1. Ensures Chezmoi, Node.js, and ZX are installed.
# 2. Installs Glow and Gum if the `HEADLESS_INSTALL` environment variable is not set. # 2. Installs Glow and Gum if the `HEADLESS_INSTALL` environment variable is not set.
# 3. If the system is macOS, then also install `gsed`. # 3. If the system is macOS, then also install `gsed` and `coreutils`.
ensureHomebrewDeps() { ensureHomebrewDeps() {
### TUI experience ### TUI experience
if [ -z "$HEADLESS_INSTALL" ]; then if [ -z "$HEADLESS_INSTALL" ]; then
@ -262,6 +263,9 @@ ensureHomebrewDeps() {
### macOS ### macOS
if [ -d /Applications ] && [ -d /System ]; then if [ -d /Applications ] && [ -d /System ]; then
installBrewPackage "gsed" installBrewPackage "gsed"
if ! command -v gtimeout > /dev/null; then
brew install coreutils
fi
fi fi
} }