Skip to content

Commit

Permalink
improve packages installation
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed Dec 28, 2023
1 parent 8ed3d4b commit 1ea6e90
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
30 changes: 21 additions & 9 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ sync_repo() {
install_package() {
if ! command -v ${1} >/dev/null 2>&1; then
if is_mac; then
brew install ${1}
brew -q install ${1}
elif is_debian; then
sudo apt-get install -y ${1}
elif is_arch; then
Expand All @@ -95,7 +95,7 @@ install_package() {
fi
else
if is_mac; then
brew upgrade ${1}
brew upgrade -q ${1}
elif is_debian; then
sudo apt-get upgrade -y ${1}
elif is_arch; then
Expand Down Expand Up @@ -144,7 +144,7 @@ promote_yn() {

# Clean or not?
if [ -d $ZSH ] || [ -d $TMUX ] || [ -d $EMACSD ]; then
promote_yn "Do you want to reset all configurations?" "continue"
promote_yn "${YELLOW}Do you want to reset all configurations?${NORMAL}" "continue"
if [ $continue -eq $YES ]; then
clean_dotfiles
fi
Expand Down Expand Up @@ -180,30 +180,30 @@ fi

# Check git
if ! command -v git >/dev/null 2>&1; then
printf "${GREEN}▓▒░ Installing git...${NORMAL}\n"
install_package git
fi

# Check curl
if ! command -v curl >/dev/null 2>&1; then
printf "${GREEN}▓▒░ Installing curl...${NORMAL}\n"
install_package curl
fi

# Check zsh
if ! command -v zsh >/dev/null 2>&1; then
printf "${GREEN}▓▒░ Installing zsh...${NORMAL}\n"
install_package zsh
fi

if is_mac && ! command -v tree >/dev/null 2>&1; then
printf "${GREEN}▓▒░ Installing tree...${NORMAL}\n"
install_package tree
fi

# ZSH plugin manager
printf "${GREEN}▓▒░ Installing Zinit...${NORMAL}\n"
if ! command -v zinit >/dev/null 2>&1; then
sh -c "$(curl -fsSL https://git.io/zinit-install)"
else
zinit self-update
fi
sh -c "$(curl -fsSL https://git.io/zinit-install)"

# Dotfiles
printf "${GREEN}▓▒░ Installing Dotfiles...${NORMAL}\n"
Expand Down Expand Up @@ -248,8 +248,20 @@ printf "${GREEN}▓▒░ Installing Oh My Tmux...${NORMAL}\n"
sync_repo gpakosz/.tmux $TMUX
ln -sf $TMUX/.tmux.conf $HOME/.tmux.conf

# Packages
printf "${GREEN}▓▒░ Installing packages...${NORMAL}\n"
if is_mac; then
./install_brew.sh
elif is_arch; then
./install_arch.sh
elif is_debian; then
./install_debian.sh
else
printf "Noting to install!"
fi

# Entering zsh
printf "Done. Enjoy!\n"
printf "${GREEN}▓▒░ Done. Enjoy!${NORMAL}\n"
if command -v zsh >/dev/null 2>&1; then
if is_cygwin && [ "$SHELL" != "$(which zsh)" ]; then
chsh -s $(which zsh)
Expand Down
7 changes: 2 additions & 5 deletions install_arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,20 @@

# Packages
packages=(
#prerequisite
git
zsh
unzip

# modern tools
bat
bottom
btop
delta
duf
dust
eza
fd
fzf
gitui
gping
hyperfine
lsd
neofetch
procs
ripgrep
Expand Down
11 changes: 4 additions & 7 deletions install_brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
# URL: https://github.com/seagle0128/dotfiles
#############################################################

# Cask applications
# Packages
packages=(
# prerequisite
git
zsh
unzip

# modern tools
bat
bottom
btop
eza
git-delta
duf
dust
Expand All @@ -24,6 +20,7 @@ packages=(
gitui
gping
hyperfine
lsd
neofetch
procs
ripgrep
Expand Down Expand Up @@ -72,7 +69,7 @@ function check {
function install () {
for app in ${packages[@]}; do
printf "${BLUE} ➜ Installing ${app}...${NORMAL}\n"
brew install ${app}
brew install -q ${app}
done
}

Expand Down
2 changes: 1 addition & 1 deletion install_ubuntu.sh → install_debian.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#############################################################
# Install and update packages for ubuntu or its derived editions.
# Install packages for Debian or its derived editions (e.g. Ubuntu, Mint).
# Author: Vincent Zhang <[email protected]>
# URL: https://github.com/seagle0128/dotfiles
#############################################################
Expand Down

0 comments on commit 1ea6e90

Please sign in to comment.