@@ -13,25 +13,25 @@ RED='\033[0;31m'
1313RESET=' \033[0m'
1414
1515function LOG() {
16- echo -e " $@ ${RESET} "
16+ echo -e " $* ${RESET} "
1717}
1818
1919function INFO() {
20- LOG ${GREEN} $@
20+ LOG " ${GREEN} $* "
2121}
2222
2323function WARN() {
24- LOG ${ORANGE} $@
24+ LOG " ${ORANGE} $* "
2525}
2626
2727function ERROR() {
28- LOG ${RED} $@
28+ LOG " ${RED} $* "
2929}
3030
3131# print the current system details
3232# this expects DOTFILES_DIR and SYSTEM to be defined
3333function print_details() {
34- LOG ${BWHITE} \
34+ LOG " ${BWHITE} " \
3535 "
3636SYSTEM: $SYSTEM
3737OS: $OS
@@ -49,18 +49,18 @@ DOTFILES_DIR: $DOTFILES_DIR
4949# This expects the variable $DOTFILES_DIR to exist
5050function sym_links() {
5151 INFO " Creating symlinks..."
52- mkdir -p $HOME /.config
53- stow -v --dotfiles --adopt --dir $DOTFILES_DIR --target $HOME --restow home
54- [[ -d $DOTFILES /private/.ssh ]] && stow -v --adopt --dir $DOTFILES_DIR /private/ --target $HOME /.ssh --restow .ssh
55- stow -v --adopt --dir $DOTFILES_DIR --target $HOME /.config/ --restow config
52+ mkdir -p " $HOME /.config"
53+ stow -v --dotfiles --adopt --dir " $DOTFILES_DIR " --target " $HOME " --restow home
54+ [[ -d $DOTFILES /private/.ssh ]] && stow -v --adopt --dir " $DOTFILES_DIR /private/" --target " $HOME /.ssh" --restow .ssh
55+ stow -v --adopt --dir " $DOTFILES_DIR " --target " $HOME /.config/" --restow config
5656 # if the adopt made a local change then undo that
5757 git checkout HEAD -- config home private
5858
5959 return 0
6060}
6161
6262function ask() {
63- read -p " $1 [$2 ] " answer
63+ read -rp " $1 [$2 ] " answer
6464 answer=" ${answer:- $2 } "
6565 case " $answer " in
6666 y | Y) return 0 ;;
@@ -71,12 +71,12 @@ function ask() {
7171
7272# ############################## Ubuntu specifics #########################################
7373function no_ppa_exists() {
74- ppa_added=$( grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -v list.save | grep -v deb-src | grep deb | grep $1 | wc -l )
75- [ $ppa_added == 0 ]
74+ ppa_added=$( grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -v " list.save" | grep -v " deb-src" | grep " deb" | grep -c " $1 " )
75+ [ " $ppa_added " == 0 ]
7676}
7777
7878function add_ppa() {
79- sudo add-apt-repository ppa:$1 -y
79+ sudo add-apt-repository ppa:" $1 " -y
8080 apt_update
8181
8282 return 0
@@ -87,7 +87,7 @@ function apt_update() {
8787}
8888
8989function apt_install() {
90- sudo apt-get install -y $@
90+ sudo apt-get install -y " $@ "
9191
9292 return 0
9393}
@@ -99,13 +99,13 @@ function pac_update() {
9999}
100100
101101function pac_install() {
102- sudo pacman -S --needed --noconfirm $@
102+ sudo pacman -S --needed --noconfirm " $@ "
103103
104104 return 0
105105}
106106
107107function yay_install() {
108- yay -S --needed --noconfirm $@ --mflags " --nocheck"
108+ yay -S --needed --noconfirm " $@ " --mflags " --nocheck"
109109
110110 return 0
111111}
@@ -117,13 +117,13 @@ function yay_update() {
117117}
118118
119119function pip3_install() {
120- sudo -H pip3 install $@
120+ sudo -H pip3 install " $@ "
121121
122122 return 0
123123}
124124
125125function sudo_rule() {
126- INFO " $USER ALL = NOPASSWD: $@ " | sudo tee -a /etc/sudoers
126+ INFO " $USER ALL = NOPASSWD: $* " | sudo tee -a /etc/sudoers
127127
128128 return 0
129129}
@@ -132,56 +132,45 @@ function sudo_rule() {
132132
133133# setup fzf
134134function fzf_install() {
135- mkdir -p $HOME /.local/bin
136- rm -rf $HOME /.fzf
137- git clone --depth 1 https://github.com/junegunn/fzf.git $HOME /.fzf
138- cd $HOME /.fzf
135+ mkdir -p " $HOME /.local/bin"
136+ rm -rf " $HOME /.fzf"
137+ git clone --depth 1 https://github.com/junegunn/fzf.git " $HOME /.fzf"
138+ cd " $HOME /.fzf" || return
139139 ./install --bin
140- cp bin/* $HOME /.local/bin/
141- cd -
140+ cp bin/* " $HOME /.local/bin/" | return
141+ cd - || return
142142}
143143
144144# install lazygit
145145function lazygit_install() {
146146 LAZYGIT_VERSION=$( curl -s " https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | \g rep -Po ' "tag_name": "v\K[^"]*' )
147- cd /tmp
147+ cd /tmp || return
148148 curl -Lo lazygit.tar.gz " https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION} _Linux_x86_64.tar.gz"
149149 tar xf lazygit.tar.gz lazygit
150- install lazygit $HOME /.local/bin
151- cd -
152- }
153-
154- # install lunarvim
155- function lunarvim_install() {
156- INFO " Installing LunarVIM..."
157- NPM_CONFIG_PREFIX=$HOME /npm-global
158-
159- # ensure there are no failures due to installing python packages
160- python3 -m pip config set global.break-system-packages true
161-
162- curl -sSL https://raw.githubusercontent.com/LunarVim/LunarVim/master/utils/installer/install.sh | LV_BRANCH=' master' bash -s -- -y
150+ install lazygit " $HOME /.local/bin"
151+ cd - || return
163152}
164153
165154# setup starship
166155function starship_install() {
167156 INFO " Installing starship..."
168157 curl -sS https://starship.rs/install.sh -o starship.sh
169158 chmod +x starship.sh
170- ./starship.sh -y --bin-dir $HOME /.local/bin
159+ ./starship.sh -y --bin-dir " $HOME /.local/bin"
171160 rm -f starship.sh
172161}
173162
174163# install the various zsh components
175164function zsh_extras() {
176165 INFO " Setting up zsh extras..."
177166 # install zgenom
178- [ ! -d $HOME /.zgenom ] && git clone https://github.com/jandamm/zgenom.git ${HOME} /.zgenom
167+ [ ! -d " $HOME /.zgenom" ] && git clone https://github.com/jandamm/zgenom.git " ${HOME} /.zgenom"
179168
180169 # install zoxide
181170 curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
182171
183172 # install fonts
184- mkdir -p $HOME /.local/bin
173+ mkdir -p " $HOME /.local/bin"
185174 curl -fsSL https://raw.githubusercontent.com/getnf/getnf/main/install.sh | bash
186- $HOME /.local/bin/getnf -i DejaVuSansMono,DroidSansMono,Hack,Recursive,RobotoMono | true # don't fail on fonts
175+ " $HOME /.local/bin/getnf" -i DejaVuSansMono,DroidSansMono,Hack,Recursive,RobotoMono | true # don't fail on fonts
187176}
0 commit comments