This commit is contained in:
root 2023-05-18 17:45:30 +00:00
parent 1d7716d7c9
commit eab82fe73b
9 changed files with 28 additions and 10 deletions

View File

@ -1,7 +1,4 @@
#!/usr/bin/env -S bash -e
[[ -z "$2" ]] && {
printf 'Usage: %s username password [user|admin] [shell] <<< pubkey\n' "$0"
exit 1
@ -24,6 +21,9 @@ chmod 755 "$_HOME/public_gopher"
chmod 755 "$_HOME/public_gcdn"
systemctl restart gemini
sed -i "s/USER/${1}/g" "$_HOME"/.config/nixpkgs/home.nix
sed -i "s/replaceme/${1}/g" "$_HOME"/.config/aerc/accounts.conf
sudo -u $1 nix-shell '<home-manager>' -A install
printf "%s\n%s\n" "$2" "$2" | passwd "$1"
zfs set userquota@"${1}"=20G pool1/home
sudo -u postgres psql -c "create role ${1};"
sudo -u postgres createdb -O ${1} ${1}

View File

@ -7,5 +7,5 @@ setfacl -R -m u:"${1}":rx /etc/letsencrypt/live/vern.cc
setfacl -R -m g:"${1}":rx /etc/letsencrypt/live/vern.cc
setfacl -R -m u:"${1}":rx /etc/letsencrypt/archive
setfacl -R -m g:"${1}":rx /etc/letsencrypt/archive
setfacl -R -m u:"${1}":rx /etc/letsencrypt/archive/vern.cc-0001
setfacl -R -m g:"${1}":rx /etc/letsencrypt/archive/vern.cc-0001
setfacl -R -m u:"${1}":rx /etc/letsencrypt/archive/vern.cc-0002
setfacl -R -m g:"${1}":rx /etc/letsencrypt/archive/vern.cc-0002

View File

@ -20,4 +20,5 @@ read -rp "Delete user $1? [y/N] "
delsuser "$1"
delauser "$1"
delfruser "$1"
delmfuser "$1"
} || exit 3

View File

@ -8,7 +8,8 @@ backupscript() {
if [ "bighdd/backup/$newsnap" != "$latestsnap" ]; then
set -x
zfs snapshot -r nvme/$newsnap
zfs send -cpI $incbackup nvme/$newsnap | pv | zfs recv -u ${targetpool}/${1}
zfs send -cpI $incbackup nvme/$newsnap |
zfs recv -u ${targetpool}/${1}
zfs destroy nvme/$newsnap
set +x
else

View File

@ -5,4 +5,4 @@
exit 1
}
su - mastodon -s /bin/bash -c "live/bin/tootctl accounts create \"$1\" --email=\"${1}@vern.cc\" --confirmed $([[ "$2" == "admin" ]] && printf '--role=admin'); live/bin/tootctl accounts modify \"$1\" --approve"
su - mastodon -s /bin/bash -c "live/bin/tootctl accounts create \"$1\" --email=\"${1}@vern.cc\" --confirmed $([[ "$2" == "admin" ]] && printf -- '--role=Admin' || [[ "$2" == "owner" ]] && printf -- '--role=Owner'); live/bin/tootctl accounts modify \"$1\" --approve"

View File

@ -10,7 +10,7 @@ TxnId() { # Random chars. Needed for sending messages. I am not using tr on /dev
done
}
instance='https://mtrx.vern.cc'
RoomId='!DbQXembCUWglXOcHRx:vern.cc'
RoomId='!TvCDlIfMEHfcpCrSow:vern.cc'
if [[ -z ${2} ]]; then
curl -s \
-X PUT \

View File

@ -1,8 +1,11 @@
#!/usr/bin/env bash
systemctl stop nginx
certbot certonly --manual # vern.cc,*.vern.cc,*.bw.vern.cc,*.fandom.vern.cc,*.breezewiki.vern.cc
systemctl start nginx
systemctl start nginx || systemctl reload nginx
cat /etc/letsencrypt/live/vern.cc/{fullchain.pem,privkey.pem} > ~znc/.znc/znc.pem
scp -r -P1816 /etc/letsencrypt iceberg.vern.cc:/etc
rsync --rsh="ssh -p1816" -rlpthi --delete-before /etc/letsencrypt iceberg.vern.cc:/etc
rsync --rsh="ssh -p1812" -rlpthi --delete-before /etc/letsencrypt ns2.vern.cc:/etc
ssh iceberg.vern.cc -p1815 "systemctl reload nginx"
ssh ns2.vern.cc -p1812 "systemctl reload nginx"
cat /etc/letsencrypt/live/vern.cc/fullchain.pem > /sshfs/var/gemini/enc/fullchain.pem
cat /etc/letsencrypt/live/vern.cc/privkey.pem > /sshfs/var/gemini/enc/privkey.pem

9
tilserv/rvm Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
virsh destroy nixos-unstable
systemctl stop libvirtd
sleep 2
systemctl start libvirtd
sleep 2
virsh list
sleep 2
virsh start nixos-unstable

4
tilserv/rvmif Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
if ping 192.168.122.30 -c 1 | grep 'Unreachable'; then
/root/bin/rvm
fi