summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-05-04 22:48:56 -0400
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-05-04 22:48:56 -0400
commit3b783e9b8911a244e31bd7928a534b517da4933f (patch)
tree10a48d9cc775761aa5ba40abe042b86c5fc00088
parentdf5072ab4f9b1ba00e59dd0cbc47706faf33a462 (diff)
Updates mac installation
-rw-r--r--public/macprogs.csv10
-rwxr-xr-xpublic/thesiah-mac.sh58
-rwxr-xr-xpublic/thesiah.sh2
-rw-r--r--static/macprogs.csv10
-rwxr-xr-xstatic/thesiah-mac.sh58
-rwxr-xr-xstatic/thesiah.sh2
6 files changed, 84 insertions, 56 deletions
diff --git a/public/macprogs.csv b/public/macprogs.csv
index 832924c..2ad68fd 100644
--- a/public/macprogs.csv
+++ b/public/macprogs.csv
@@ -18,12 +18,12 @@ C,firefox,is a web browser.
C,fliqlo,is a flip clock screensaver.
,fzf,is a command-line fuzzy finder written in Go.
,git-delta,is a syntax-highlighting pager for git and diff output.
-M,handmirror,is a one-click camera check.
+M,Hand Mirror,is a one-click camera check.
C,iina,is a minimalist IRC client.
-M,irightmouse,is a powerful macOS right-click menu tool.
+M,iRightMouse,is a powerful macOS right-click menu tool.
C,itsycal,is a menu bar calendar.
C,jump,is a remote desktop application.
-M,kakaotalk,"is an easy,not-cost messenger for Korean."
+M,KakaoTalk,"is an easy,not-cost messenger for Korean."
C,karabiner-elements,is a keyboard customiser.
C,keka,is a file archiver.
C,keycastr,is an open-source keystroke visualiser.
@@ -45,7 +45,7 @@ C,oversight,monitors computer mic and webcam.
,pass,is a password manager.
,pass-otp,is a pass extension for managing one-time-password tokens.
,php,is a general-purpose scripting language.
-M,PurePaste,pastes as plain text.
+M,Pure Paste,pastes as plain text.
P,pynvim,is for lsp in neovim.
,ripgrep,searches tool like grep and the silver searcher.
,ripgrep-all,is a wrapper around ripgrep that adds multiple rich file types.
@@ -57,7 +57,7 @@ C,textsniper,extracts text from iamges and other digital documents.
,tmux,is a terminal multiplexer.
,tmuxinator,manages complex tmux sessions easily.
C,vlc,is a multimedia player.
-M,weatherbug,forecasts weather on the menu bar.
+M,WeatherBug,forecasts weather on the menu bar.
C,whatsapp,is a native desktop client for Whatsapp.
,wget,is an internet file retriever.
C,xquartz,is an open-source version of the x.org x window system.
diff --git a/public/thesiah-mac.sh b/public/thesiah-mac.sh
index b793c9a..19cd069 100755
--- a/public/thesiah-mac.sh
+++ b/public/thesiah-mac.sh
@@ -6,10 +6,10 @@
### VARIABLES ###
-dotfilesrepo="https://github.com/thesiah/.dotfiles.git"
+name=$(whoami) # Use the current user's name
+dotfilesrepo="https://github.com/TheSiahxyz/mac.git"
progsfile="https://raw.githubusercontent.com/thesiah/THESIAH/main/static/macprogs.csv"
repobranch="main"
-name=$(whoami) # Use the current user's name
### FUNCTIONS ###
@@ -26,13 +26,35 @@ error() {
exit 1
}
+# Get user's password
+getuserandpass() {
+ # Prompts user for new username an password.
+ pass1=$(echo "Enter a password for that user:")
+ pass2=$(echo "Retype password:")
+ while ! [ "$pass1" = "$pass2" ]; do
+ unset pass2
+ pass1=$(echo "Passwords do not match.\\n\\nEnter password again:")
+ pass2=$(echo "Retype password:")
+ done
+}
+
+# Install Homebrew
+brewinstall() {
+ if ! command -v brew &>/dev/null; then
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+ fi
+ brew update >/dev/null 2>&1
+ brew upgrade >/dev/null 2>&1
+ eval "$(/opt/homebrew/bin/brew shellenv)"
+}
+
# Install Homebrew packages
installpkg() {
if brew list "$1" &>/dev/null; then
echo "$1 is already installed."
else
echo "Installing $1..."
- brew install "$1" || error "Failed to install $1."
+ $pass1 | brew install "$1" || error "Failed to install $1."
fi
}
@@ -42,7 +64,7 @@ caskinstall() {
echo "$1 is already installed."
else
echo "Installing $1..."
- brew install --cask "$1" || error "Failed to install $1."
+ $pass1 | brew install --cask "$1" || error "Failed to install $1."
fi
}
@@ -65,24 +87,19 @@ tapinstall() {
brew tap "$repo" || error "Failed to tap $repo."
echo "Installing package: $pkg from tap"
- brew install "$pkg" || error "Failed to install $pkg from tap."
+ $pass1 | brew install "$pkg" || error "Failed to install $pkg from tap."
}
# Install mac apps with mas
masinstall() {
echo "Installing the mac app: $1"
- if ! command -v mas &>/dev/null; then
- installpkg mas # This installs mas
- fi
-
+
# Search for the app by name and get its ID using awk to parse the output
- id=$(mas search "$1" | awk -F ' ' '{print $1; exit}')
-
+ id=$(mas search "$1" | awk -v appName="$1" '{if ($0 ~ appName) {print $1; exit}}')
# Check if the id variable is set and not empty
if [ -z "$id" ]; then
error "Failed to find an ID for the app named $1."
else
- echo "Installing the app with ID $id..."
mas install "$id" || error "Failed to install the app $1."
fi
}
@@ -120,29 +137,26 @@ finalize() {
echo "Congrats! Provided there were no hidden errors, the script completed successfully and all the programs and configuration files should be in place.\\n\\nTo run the new graphical environment, log out and log back in as your new user, then run the command \"startx\" to start the graphical environment (it will start automatically in tty1).\\n\\n.t Soomin"
}
-brewinstall() {
- if ! command -v brew &>/dev/null; then
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- fi
- brew update >/dev/null 2>&1
- brew upgrade >/dev/null 2>&1
-}
-
### Main Installation Process ###
+# Store user's password
+getuserandpass
# Ensure Homebrew is installed
brewinstall || error "Failed to install Homebrew."
+# Ensure mas is installed
+installpkg "mas"
+
# Start the installation loop for software from the CSV
installationloop
# Setup Dotfiles
-putgitrepo "$dotfilesrepo" "$HOME" "$repobranch"
+putgitrepo "$dotfilesrepo" "$HOME/.dotfiles" "$repobranch"
# Clean up any unwanted files from the dotfiles repo
rm -rf "$HOME/.git" "$HOME/README.md" "$HOME/LICENSE" "$HOME/FUNDING.yml" "/tmp/programs.csv"
-ln -s ~/.dotfiles/mac/.zprofile ~/.zprofile
+ln -s ~/.dotfiles/shell/profile ~/.zprofile
# Final
finalize
diff --git a/public/thesiah.sh b/public/thesiah.sh
index 2807c38..b8fa5ed 100755
--- a/public/thesiah.sh
+++ b/public/thesiah.sh
@@ -338,7 +338,7 @@ ntpd -q -g >/dev/null 2>&1
adduserandpass || error "Error adding username and/or password."
-mkdir -p /home/$name/{.config,Documents,Downloads,Music,Pictures,Videos} /home/$name/Media/{personal,portable,sda,sdb,share,ssd} /home/$name/Torrents/{complete,incomplete} /home/$name/.local/{bin,share,src,state} >/dev/null 2>&1
+mkdir -p /home/$name/{.config,Documents,Downloads,Music,Pictures,Videos} /home/$name/Media/{flash,personal,sda,sdb,sdc,sdd,storage} /home/$name/Torrents/{complete,incomplete} /home/$name/.local/{bin,share,src,state} >/dev/null 2>&1
[ -f /etc/sudoers.pacnew ] && cp /etc/sudoers.pacnew /etc/sudoers # Just in case
diff --git a/static/macprogs.csv b/static/macprogs.csv
index 832924c..2ad68fd 100644
--- a/static/macprogs.csv
+++ b/static/macprogs.csv
@@ -18,12 +18,12 @@ C,firefox,is a web browser.
C,fliqlo,is a flip clock screensaver.
,fzf,is a command-line fuzzy finder written in Go.
,git-delta,is a syntax-highlighting pager for git and diff output.
-M,handmirror,is a one-click camera check.
+M,Hand Mirror,is a one-click camera check.
C,iina,is a minimalist IRC client.
-M,irightmouse,is a powerful macOS right-click menu tool.
+M,iRightMouse,is a powerful macOS right-click menu tool.
C,itsycal,is a menu bar calendar.
C,jump,is a remote desktop application.
-M,kakaotalk,"is an easy,not-cost messenger for Korean."
+M,KakaoTalk,"is an easy,not-cost messenger for Korean."
C,karabiner-elements,is a keyboard customiser.
C,keka,is a file archiver.
C,keycastr,is an open-source keystroke visualiser.
@@ -45,7 +45,7 @@ C,oversight,monitors computer mic and webcam.
,pass,is a password manager.
,pass-otp,is a pass extension for managing one-time-password tokens.
,php,is a general-purpose scripting language.
-M,PurePaste,pastes as plain text.
+M,Pure Paste,pastes as plain text.
P,pynvim,is for lsp in neovim.
,ripgrep,searches tool like grep and the silver searcher.
,ripgrep-all,is a wrapper around ripgrep that adds multiple rich file types.
@@ -57,7 +57,7 @@ C,textsniper,extracts text from iamges and other digital documents.
,tmux,is a terminal multiplexer.
,tmuxinator,manages complex tmux sessions easily.
C,vlc,is a multimedia player.
-M,weatherbug,forecasts weather on the menu bar.
+M,WeatherBug,forecasts weather on the menu bar.
C,whatsapp,is a native desktop client for Whatsapp.
,wget,is an internet file retriever.
C,xquartz,is an open-source version of the x.org x window system.
diff --git a/static/thesiah-mac.sh b/static/thesiah-mac.sh
index b793c9a..19cd069 100755
--- a/static/thesiah-mac.sh
+++ b/static/thesiah-mac.sh
@@ -6,10 +6,10 @@
### VARIABLES ###
-dotfilesrepo="https://github.com/thesiah/.dotfiles.git"
+name=$(whoami) # Use the current user's name
+dotfilesrepo="https://github.com/TheSiahxyz/mac.git"
progsfile="https://raw.githubusercontent.com/thesiah/THESIAH/main/static/macprogs.csv"
repobranch="main"
-name=$(whoami) # Use the current user's name
### FUNCTIONS ###
@@ -26,13 +26,35 @@ error() {
exit 1
}
+# Get user's password
+getuserandpass() {
+ # Prompts user for new username an password.
+ pass1=$(echo "Enter a password for that user:")
+ pass2=$(echo "Retype password:")
+ while ! [ "$pass1" = "$pass2" ]; do
+ unset pass2
+ pass1=$(echo "Passwords do not match.\\n\\nEnter password again:")
+ pass2=$(echo "Retype password:")
+ done
+}
+
+# Install Homebrew
+brewinstall() {
+ if ! command -v brew &>/dev/null; then
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
+ fi
+ brew update >/dev/null 2>&1
+ brew upgrade >/dev/null 2>&1
+ eval "$(/opt/homebrew/bin/brew shellenv)"
+}
+
# Install Homebrew packages
installpkg() {
if brew list "$1" &>/dev/null; then
echo "$1 is already installed."
else
echo "Installing $1..."
- brew install "$1" || error "Failed to install $1."
+ $pass1 | brew install "$1" || error "Failed to install $1."
fi
}
@@ -42,7 +64,7 @@ caskinstall() {
echo "$1 is already installed."
else
echo "Installing $1..."
- brew install --cask "$1" || error "Failed to install $1."
+ $pass1 | brew install --cask "$1" || error "Failed to install $1."
fi
}
@@ -65,24 +87,19 @@ tapinstall() {
brew tap "$repo" || error "Failed to tap $repo."
echo "Installing package: $pkg from tap"
- brew install "$pkg" || error "Failed to install $pkg from tap."
+ $pass1 | brew install "$pkg" || error "Failed to install $pkg from tap."
}
# Install mac apps with mas
masinstall() {
echo "Installing the mac app: $1"
- if ! command -v mas &>/dev/null; then
- installpkg mas # This installs mas
- fi
-
+
# Search for the app by name and get its ID using awk to parse the output
- id=$(mas search "$1" | awk -F ' ' '{print $1; exit}')
-
+ id=$(mas search "$1" | awk -v appName="$1" '{if ($0 ~ appName) {print $1; exit}}')
# Check if the id variable is set and not empty
if [ -z "$id" ]; then
error "Failed to find an ID for the app named $1."
else
- echo "Installing the app with ID $id..."
mas install "$id" || error "Failed to install the app $1."
fi
}
@@ -120,29 +137,26 @@ finalize() {
echo "Congrats! Provided there were no hidden errors, the script completed successfully and all the programs and configuration files should be in place.\\n\\nTo run the new graphical environment, log out and log back in as your new user, then run the command \"startx\" to start the graphical environment (it will start automatically in tty1).\\n\\n.t Soomin"
}
-brewinstall() {
- if ! command -v brew &>/dev/null; then
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- fi
- brew update >/dev/null 2>&1
- brew upgrade >/dev/null 2>&1
-}
-
### Main Installation Process ###
+# Store user's password
+getuserandpass
# Ensure Homebrew is installed
brewinstall || error "Failed to install Homebrew."
+# Ensure mas is installed
+installpkg "mas"
+
# Start the installation loop for software from the CSV
installationloop
# Setup Dotfiles
-putgitrepo "$dotfilesrepo" "$HOME" "$repobranch"
+putgitrepo "$dotfilesrepo" "$HOME/.dotfiles" "$repobranch"
# Clean up any unwanted files from the dotfiles repo
rm -rf "$HOME/.git" "$HOME/README.md" "$HOME/LICENSE" "$HOME/FUNDING.yml" "/tmp/programs.csv"
-ln -s ~/.dotfiles/mac/.zprofile ~/.zprofile
+ln -s ~/.dotfiles/shell/profile ~/.zprofile
# Final
finalize
diff --git a/static/thesiah.sh b/static/thesiah.sh
index 2807c38..b8fa5ed 100755
--- a/static/thesiah.sh
+++ b/static/thesiah.sh
@@ -338,7 +338,7 @@ ntpd -q -g >/dev/null 2>&1
adduserandpass || error "Error adding username and/or password."
-mkdir -p /home/$name/{.config,Documents,Downloads,Music,Pictures,Videos} /home/$name/Media/{personal,portable,sda,sdb,share,ssd} /home/$name/Torrents/{complete,incomplete} /home/$name/.local/{bin,share,src,state} >/dev/null 2>&1
+mkdir -p /home/$name/{.config,Documents,Downloads,Music,Pictures,Videos} /home/$name/Media/{flash,personal,sda,sdb,sdc,sdd,storage} /home/$name/Torrents/{complete,incomplete} /home/$name/.local/{bin,share,src,state} >/dev/null 2>&1
[ -f /etc/sudoers.pacnew ] && cp /etc/sudoers.pacnew /etc/sudoers # Just in case