ftp -o - https://jcs.org/move_in | sh -
at master 49 lines 1.0 kB view raw
1#!/bin/sh 2 3# doas pip3 install pyobjc-framework-Quartz 4if [ X`uname -s` = X"Darwin" ]; then 5 python3 -c 'import sys, Quartz, time' 6 if [ $? -ne 0 ]; then 7 echo "" 8 echo "Quartz python module not installed" 9 echo "pip3 install pyobjc-framework-Quartz" 10 echo "" 11 exit 1 12 fi 13fi 14 15while :; do 16 host jcs.org > /dev/null 2>&1 17 if [ $? -eq 0 ]; then 18 env SSH_AUTH_SOCK= ssh -t \ 19 -o ServerAliveInterval=5 \ 20 -o ServerAliveCountMax=3 \ 21 -o ForwardAgent=no \ 22 -o AddKeysToAgent=no \ 23 -i ~/.ssh/id_chat_ed25519 \ 24 chat@jcs.org "tmux -u new-session -A -s main" 25 26 if [ X"$?" = X"0" ]; then 27 exit 28 fi 29 30 # wait until screen is not locked 31 sleep 1 32 if [ X`uname -s` = X"Darwin" ]; then 33 python3 -c 'import sys, Quartz, time 34while True: 35 d = Quartz.CGSessionCopyCurrentDictionary() 36 if d.get("CGSSessionScreenIsLocked", 0) == 0: 37 sys.exit(0) 38 time.sleep(0.5) 39' 40 elif [ X`uname -s` = X"OpenBSD" ]; then 41 sleep 1 42 while [ X`pgrep slock` != X"" ]; do 43 sleep 1 44 done 45 fi 46 fi 47 48 sleep 2 49done