Some fixes

This commit is contained in:
Tobias Herre 2025-05-01 06:40:53 -04:00
parent 1cb81284c9
commit a4f87b9d57
6 changed files with 45 additions and 41 deletions

View File

@ -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() {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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