move functions above all

This commit is contained in:
2026-06-09 13:38:37 +02:00
parent 9b1f96ba81
commit 0f53834083

View File

@@ -7,17 +7,6 @@ set -e
LOGIN="$1" LOGIN="$1"
[ -z "$LOGIN" ] && { echo "Użycie: $0 <login>"; exit 1; } [ -z "$LOGIN" ] && { echo "Użycie: $0 <login>"; 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 200MB)
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_neomutt () {
for dir in "Inbox" "Sent" "Drafts" "Trash"; do for dir in "Inbox" "Sent" "Drafts" "Trash"; do
for subdir in "cur" "new" "tmp"; do for subdir in "cur" "new" "tmp"; do
@@ -29,15 +18,6 @@ setup_neomutt () {
chmod -R 0700 /home/"$LOGIN"/Maildir chmod -R 0700 /home/"$LOGIN"/Maildir
} }
cp -r /root/helpers/public_html /home/$LOGIN/
sed -i "s/<<USER>>/$LOGIN/g" /home/$LOGIN/public_html/index.php
sed -i "s/<<USER>>/$LOGIN/g" /home/$LOGIN/public_html/parts/header.php
sed -i "s/<<USER>>/$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 () { setup_tmux () {
mkdir -p /home/"$LOGIN"/.config/tmux mkdir -p /home/"$LOGIN"/.config/tmux
cat << EOF > /home/"$LOGIN"/.config/tmux/tmux.conf cat << EOF > /home/"$LOGIN"/.config/tmux/tmux.conf
@@ -70,10 +50,32 @@ setup_gemini () {
EOF 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 200MB)
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_neomutt
setup_tmux setup_tmux
setup_gemini setup_gemini
cp -r /root/helpers/public_html "/home/$LOGIN/"
sed -i "s/<<USER>>/$LOGIN/g" "/home/$LOGIN/"public_html/index.php
sed -i "s/<<USER>>/$LOGIN/g" "/home/$LOGIN/"public_html/parts/header.php
sed -i "s/<<USER>>/$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" cat << EOF > "/home/$LOGIN/.profile"
if [ -z "\$TMUX" ]; then if [ -z "\$TMUX" ]; then
exec tmux attach -t main || exec tmux new -s main exec tmux attach -t main || exec tmux new -s main