#!/bin/bash # set -x logger "openslx sharemapper: Started." OWNDIR=$(dirname $0) for i in "$(dirname $0)"/includes/*.inc; do source "$i" done # Wait for network connection to base system #!/bin/bash x=1 while ! ping -w 1 -c 1 "${NATADDR}" 2>/dev/null 1>&2; do [ "$x" -gt 20 ] && { logger "openslx sharemapper: could not reach base system. Giving up."; exit 1; } let x=x+1 sleep 2 done logger "openslx sharemapper: base system reaching; commencing." # REMAPMODE (remapMode): 0: None, 1 Native, 2 Native Fallback, 3 vmware # CREATEMISSING (createMissingRemap): 0: Nichts tun, 1 xdg-Verzeichnisse case "$REMAPMODE" in 0) logger "openslx sharemapper: remapMode 0 (do nothing) detected." exit 0 ;; 1) logger "openslx sharemapper: remapMode 1 (native mode) detected." preliminaries_native get_creds # fills global var PW with (currently) decrypted password get_shares # fills array ROHSHARES; row 0 global infos from (shares-)CONFIGFILE, # following rows: column 1 share path, col 2 drive letter, col 3 share name, # column 4 username, col 5 password. mount_shares # mounts shares given in array ROHSHARES. exit 0 ;; 2) logger "openslx sharemapper: remapMode 2 (fallback mode) detected." preliminaries_native get_creds # fills global var PW with (currently) decrypted password get_shares # fills array ROHSHARES; row 0 global infos from (shares-)CONFIGFILE, # following rows: column 1 share path, col 2 drive letter, col 3 share name, # column 4 username, col 5 password. mount_shares # mounts shares given in array ROHSHARES. check_fallback # checks for a mounted home and fallbacks to vmware share, if none found. exit 0 ;; 3) logger "openslx sharemapper: remapMode 3 (vmware mode) detected." preliminaries_vmware mount_shares # mounts shares given in array ROHSHARES - runvirt checks whether there's # a home share given or not.. exit 0 ;; *) logger "openslx sharemapper: unknown remapMode in $SLXCONFIGFILE; doing nothing end exiting with error." exit 1. ;; esac exit 0