commit 35d4cf245b7896bcebbcab1ebb8223109b8069b7
parent cc058359119a6d66513df22f5d5fac9fe9ee31c2
Author: Markus Hanetzok <markus@hanetzok.net>
Date: Thu, 30 Mar 2023 05:04:41 +0200
Use '$homedir' variable
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/zerog b/zerog
@@ -37,7 +37,8 @@ prepare() {
cd /tmp && curl -O "$progs" || { error "Could not download progs.list"; }
# Check for src dir and create if not found
- [ -d "/home/$name/.local/src" ] || sudo -u "$name" mkdir -p /home/"$name"/.local/src
+ [ -d "/$homedir/.local/src" ] || sudo -u "$name" mkdir -p /"$homedir"/.local/src
+
}
install_programs() { # Read from progs.list and install each entry
@@ -51,13 +52,13 @@ install_programs() { # Read from progs.list and install each entry
get_dotfiles() { # Download dotfiles and place them in $HOME
printf "### Installing dotfiles ###\n"
sudo -u "$name" git clone "$dotfiles" /tmp/dotfiles >/dev/null 2>>"$logfile" || { error "Could not clone dotfiles"; }
- sudo -u "$name" cp -rfT /tmp/dotfiles "/home/$name" >/dev/null 2>>"$logfile"
+ sudo -u "$name" cp -rfT /tmp/dotfiles "/$homedir" >/dev/null 2>>"$logfile"
}
suckless() { # Clone and install suckless programs
printf "### Installing suckless software ###\n"
for program in dwm st dmenu; do
- cd /home/"$name"/.local/src
+ cd /$homedir"/.local/src
printf "Installing $program\n"
sudo -u "$name" git clone "$suckless"/"$program" >/dev/null 2>>"$logfile" || { error "Could not clone $program"; }
cd "$program" && make clean install >/dev/null 2>>"$logfile" || { error "Could not install $program"; }
@@ -71,15 +72,15 @@ follow_up() {
chsh -s /bin/zsh "$name" >/dev/null 2>>"$logfile"
# Create some needed dirs
- sudo -u "$name" mkdir -p "/home/$name/.cache/zsh/"
- sudo -u "$name" mkdir -p "/home/$name/.config/mpd/playlists/"
+ sudo -u "$name" mkdir -p "/$homedir/.cache/zsh/"
+ sudo -u "$name" mkdir -p "/$homedir/.config/mpd/playlists/"
# Turn off the computer beep
rmmod pcspkr
printf "blacklist pcspkr\n" >/etc/modprobe.d/nobeep.conf
# Get rid of no longer needed bash files
- yes | rm /home/$name/.bash*
+ yes | rm /$homedir/.bash*
# Add some services to default runtime
rc-update add avahi-daemon default >/dev/null