From 0f53834083420651ed5d5192f8cbcb08f60d550a Mon Sep 17 00:00:00 2001 From: Smoorg Date: Tue, 9 Jun 2026 13:38:37 +0200 Subject: [PATCH] move functions above all --- add_user.sh | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/add_user.sh b/add_user.sh index 0d91959..4b8b0b6 100755 --- a/add_user.sh +++ b/add_user.sh @@ -7,17 +7,6 @@ set -e LOGIN="$1" [ -z "$LOGIN" ] && { echo "Użycie: $0 "; exit 1; } -# 1. Użytkownik i hasło -PASS="$(openssl rand -base64 16 | sed 's/[\/\+\=\\]//g')" -adduser -D -s /bin/sh -h /home/$LOGIN -H "$LOGIN" -echo "$LOGIN:$PASS" | chpasswd -addgroup $LOGIN tildeusers - -# 2. Dataset ZFS (quota 200 MB) -zfs create -o mountpoint=/home/$LOGIN -o quota=200M tank/ROOT/homes/$LOGIN -chown $LOGIN:$LOGIN /home/$LOGIN -cat "export EDITOR=nvim" >> /home/$LOGIN/.ashrc - setup_neomutt () { for dir in "Inbox" "Sent" "Drafts" "Trash"; do for subdir in "cur" "new" "tmp"; do @@ -29,15 +18,6 @@ setup_neomutt () { chmod -R 0700 /home/"$LOGIN"/Maildir } -cp -r /root/helpers/public_html /home/$LOGIN/ -sed -i "s/<>/$LOGIN/g" /home/$LOGIN/public_html/index.php -sed -i "s/<>/$LOGIN/g" /home/$LOGIN/public_html/parts/header.php -sed -i "s/<>/$LOGIN/g" /home/$LOGIN/public_html/blog/index.php - -mkdir -p /home/$LOGIN/.config/weechat/ - -cp /root/helpers/irc.conf /home/$LOGIN/.config/weechat - setup_tmux () { mkdir -p /home/"$LOGIN"/.config/tmux cat << EOF > /home/"$LOGIN"/.config/tmux/tmux.conf @@ -70,10 +50,32 @@ setup_gemini () { EOF } +# 1. Użytkownik i hasło +PASS="$(openssl rand -base64 16 | sed 's/[\/\+\=\\]//g')" +adduser -D -s /bin/sh -h "/home/$LOGIN" -H "$LOGIN" +echo "$LOGIN:$PASS" | chpasswd +addgroup $LOGIN tildeusers + +# 2. Dataset ZFS (quota 200 MB) +zfs create -o mountpoint="/home/$LOGIN" -o quota=200M tank/ROOT/homes/$LOGIN +chown $LOGIN:$LOGIN /home/$LOGIN +cat "export EDITOR=nvim" >> "/home/$LOGIN/.ashrc" + + setup_neomutt setup_tmux setup_gemini +cp -r /root/helpers/public_html "/home/$LOGIN/" +sed -i "s/<>/$LOGIN/g" "/home/$LOGIN/"public_html/index.php +sed -i "s/<>/$LOGIN/g" "/home/$LOGIN/"public_html/parts/header.php +sed -i "s/<>/$LOGIN/g" "/home/$LOGIN/"public_html/blog/index.php + +mkdir -p "/home/$LOGIN/".config/weechat/ + +cp /root/helpers/irc.conf "/home/$LOGIN/".config/weechat + + cat << EOF > "/home/$LOGIN/.profile" if [ -z "\$TMUX" ]; then exec tmux attach -t main || exec tmux new -s main