From a4f87b9d57e5bc4aabaf19f73dfc7c0506d8ef25 Mon Sep 17 00:00:00 2001 From: Tobias Herre Date: Thu, 1 May 2025 06:40:53 -0400 Subject: [PATCH] Some fixes --- install.sh | 2 ++ wmde-rp-config.prf | 10 ++++++++- wmde-rp-full.prf | 3 +-- wmde-rp-init.sh | 47 +++++++++++++++++------------------------ wmde-rp-usersync-ssh.sh | 20 +++++++++++------- wmde-rp.conf | 4 ++-- 6 files changed, 45 insertions(+), 41 deletions(-) diff --git a/install.sh b/install.sh index 1ad6641..8505fef 100755 --- a/install.sh +++ b/install.sh @@ -40,6 +40,8 @@ copy_files() { cp wmde-rp-full.prf /etc cp wmde-rp-config.prf /etc + cp wmde-rp-perm.prf /etc + cp wmde-rp.conf /etc } update_pam() { diff --git a/wmde-rp-config.prf b/wmde-rp-config.prf index a6200bd..5f5f765 100644 --- a/wmde-rp-config.prf +++ b/wmde-rp-config.prf @@ -1,10 +1,18 @@ -ignore = Path Local +ignore=Name * +ignorenot=Path .config +ignorenot=Path .local/share/backgrounds" +ignorenot=Path .thunderbird +ignorenot=Path .mozilla ignore = Name .cache ignore = Name .cache2 ignore = Path .thunderbird/*/ImapMail +ignore = Path .thunderbird/*/Mail ignore = Path .mozilla/firefox/*/storage ignore = Path .mozilla/firefox/*/lock ignore = Path snap/firefox/common/.mozilla/firefox/*/storage ignore = Path .config/goa-1.0/accounts.conf ignore = Path .config/sipgate-softphone/Cache +ignorenot=Name *.kdbx +ignorenot=Path ./cache/keepassxc +ignore = Path Local diff --git a/wmde-rp-full.prf b/wmde-rp-full.prf index a6200bd..2a6d2a5 100644 --- a/wmde-rp-full.prf +++ b/wmde-rp-full.prf @@ -2,9 +2,8 @@ ignore = Path Local ignore = Name .cache ignore = Name .cache2 ignore = Path .thunderbird/*/ImapMail -ignore = Path .mozilla/firefox/*/storage ignore = Path .mozilla/firefox/*/lock ignore = Path snap/firefox/common/.mozilla/firefox/*/storage ignore = Path .config/goa-1.0/accounts.conf ignore = Path .config/sipgate-softphone/Cache - +ignore = Path Downloads diff --git a/wmde-rp-init.sh b/wmde-rp-init.sh index 1fdca6f..fcfcfd9 100755 --- a/wmde-rp-init.sh +++ b/wmde-rp-init.sh @@ -12,11 +12,9 @@ cd /tmp . $PREFIX/wmde-rp-check-pam-user.sh #exit if user does not belong to rp criteria - #echo "WMDE Roaming Profile" export HOMEDIR=$(getent passwd "$PAM_USER" | cut -d: -f6) -export WMDE_UNISONARGS="-auto -log -prefer newer -batch" export UNISON=$HOMEDIR/.unison-wmde export PAM_USER=$PAM_USER export SSHARGS="-o UserKnownHostsFile=$HOMEDIR/.wmdesync/known_hosts" @@ -27,39 +25,39 @@ export SSHARGS="-o UserKnownHostsFile=$HOMEDIR/.wmdesync/known_hosts" TIMEOUT=30 +echo "WAIT_FOR_FULLSYNC=$WAIT_FOR_FULLSYNC" >> /tmp/wtforsyc.txt +echo "WAIT_FOR_CONFIGC=$WAIT_FOR_CONFIG" >> /tmp/wtforsyc.txt -#if [ -f "$FIFULLSYNC" ]; then -# exit 0 -#fi +if [ "$WAIT_FOR_CONFIG" = "never" ] && [ "$WAIT_FOR_FULLSYNC" = "never" ] ; then + echo "Both, WAIT_FOR_CONFIG and WAIT_FOR_FULLSYNC are never - exit 0" >> /tmp/wtforsyc.txt + exit 0 +fi + if [ ! -f "$FIRSTSYNC" ]; then FIRSTRUN="first" + echo "File $FIRSTSYNC does not exists, setting FIRSTRUN=$FIRSTRUN." >> /tmp/wtforsyc.txt else FIRSTRUN="no" - + echo "File $FIRSTSYNC found, setting FIRSTRUN=$FIRSTRUN." >> /tmp/wtforsyc.txt fi -echo "FIRST $FIRSTRUN" >> /tmp/wtforsyc.txt -if [ "$WAIT_FOR_CONFIG" = "never" ] && [ "$WAIT_FOR_FULLSYNC" = "never" ] && [ "$WAIT_FOR_SMALLFILESSYNC" = "never" ]; then - exit 0 -fi - # wait for pid file to be created (max 30 seconds) i=0 while [ $i -lt $TIMEOUT ]; do - echo "WAITING FOR PIDFILE $i" >> /tmp/wtforsyc.txt - if [ -f "$PIDFILE" ]; then - echo "FOUND PID FILE" >> /tmp/wtforsyc.txt - PID=`cat $PIDFILE` - if kill -0 "$PID" 2>/dev/null; then - break + if [ -f "$PIDFILE" ]; then + PID=`cat $PIDFILE` + echo "Found pid file $PIDFILEE with content: $PID" >> /tmp/wtforsyc.txt + if kill -0 "$PID" 2>/dev/null; then + break + fi fi - fi - sleep 1 - i=$((i + 1)) + echo "No pid file $PIDFILE found, waiting sice $seconds" >> /tmp/wtforsyc.txt + sleep 1 + i=$((i + 1)) done if [ $i -eq $TIMEOUT ]; then echo "NO PIDFILE - ERROR" >> /tmp/wtforsyc.txt @@ -90,16 +88,9 @@ wait_for_sync() { if [ "$WAIT_FOR_CONFIG" = "always" ] || [ "$WAIT_FOR_CONFIG" = "$FIRSTRUN" ]; then echo "Wait for Config" >> /tmp/wtforsyc.txt - wait_for_sync $HOMEDIR/.config $CONFIGSYNC "Loading config:" "" + wait_for_sync $HOMEDIR/ $CONFIGSYNC "Loading config:" "" fi -if [ "$WAIT_FOR_SMALLFILESSYNC" = "always" ] || [ "$WAIT_FOR_SMALLFILESSYNC" = "$FIRSTRUN" ]; then - echo "Wait for Small files" >> /tmp/wtforsyc.txt - wait_for_sync $HOMEDIR $SMALLFILESSYNC "Loading small files:" "" -fi - - - if [ "$WAIT_FOR_FULLSYNC" = "always" ] || [ "$WAIT_FOR_FULLSYNC" = "$FIRSTRUN" ]; then diff --git a/wmde-rp-usersync-ssh.sh b/wmde-rp-usersync-ssh.sh index 69334bf..15fe590 100755 --- a/wmde-rp-usersync-ssh.sh +++ b/wmde-rp-usersync-ssh.sh @@ -85,12 +85,13 @@ fi IGNORES="-ignore 'Path .wmdesync'" -OTHERARGS="-auto -log -prefer newer -maxerrors 500000 -fastcheck" +OTHERARGS="-auto -log -prefer newer -maxerrors 500000 -fastcheck true" export UNISONLOCALHOSTNAME=`hostname` export UNISON=$HOMEDIR/.wmdesync/unison-$UNISONLOCALHOSTNAME WMDE_UNISON_PRF=/etc/wmde-rp-full.prf WMDE_UNISON_CFG_PRF=/etc/wmde-rp-config.prf +WMDE_UNISON_PERM_PRF=/etc/wmde-rp-perm.prf SERVERCMD="UNISONLOCALHOSTNAME=$UNISONLOCALHOSTNAME UNISON=$UNISON unison" @@ -156,6 +157,7 @@ generate_profile() { generate_profile full generate_profile config +generate_profile perm #cp "$WMDE_UNISON_PRF" "$UNISON/full.prf"; #cp "$WMDE_UNISON_CFG_PRF" "$UNISON/config.prf"; @@ -163,15 +165,17 @@ generate_profile config # Sync config -for item in $CONFIGDIRS; do - CONFIGDIRSARGS="$CONFIGDIRSARGS -path $item" -done +#for item in $CONFIGDIRS; do +# CONFIGDIRSARGS="$CONFIGDIRSARGS -path $item" +#done -unison config -times -sshargs "$SSHARGS" -servercmd "$SERVERCMD" $OTHERARGS -batch -ignore 'Path .wmdesync' $CONFIGDIRSARGS +yes | unison config -times -sshargs "$SSHARGS" -servercmd "$SERVERCMD" $OTHERARGS -batch -ignore 'Path .wmdesync' + +echo "PUT PID INTO CONFIG_SYNC" + echo "$$" > $CONFIGSYNC - -echo "$$" > $SMALLFILESSYNC +echo "DONE PUT PID INTO CONFIG_SYNC" # Sync all yes | unison full -times -sshargs "$SSHARGS" -servercmd "$SERVERCMD" $OTHERARGS -batch -ignore 'Path .wmdesync' @@ -179,7 +183,7 @@ echo "$$" > $FULLSYNC echo "$$" > $FIRSTSYNC # Sync all & repeat -yes | unison full -times -sshargs "$SSHARGS" -servercmd "$SERVERCMD" $OTHERARGS -batch -ignore 'Path .wmdesync' -repeat watch+60 +yes | unison perm -times -sshargs "$SSHARGS" -servercmd "$SERVERCMD" $OTHERARGS -batch -ignore 'Path .wmdesync' -repeat watch+60 exit 0 diff --git a/wmde-rp.conf b/wmde-rp.conf index 5cc1f09..1c4d920 100644 --- a/wmde-rp.conf +++ b/wmde-rp.conf @@ -13,12 +13,12 @@ NETGROUPS="wmde-rp-general" WAIT_FOR_CONFIG=always # always, first or never -WAIT_FOR_SMALLFILESSYNC=first # always, first or never WAIT_FOR_FULLSYNC=never # always, first or never CONFIGDIRS=".config \ - .local/share/backgrounds" + .local/share/backgrounds \ + .ssh" SMALLFILESSIZE=1024