# (mine are set at the beginning of this file)
# SL_FILES_DIR: Environment variable. Path to folder which should at
-# least have a .bashrc file or symlink. This dir will be rsynced to
-# remote hosts unless the host already has a $SL_FILES_DIR/.bashrc. In
-# that case, we assume it is a host you control and sync files to
-# separately and already has the ~/.bashrc you want. Symlinks in this
-# dir will be resolved. The directory name is important, it will be
-# created on the remote host under /root. The remote bash will also take
-# its .inputrc config from this folder (default of not existing is
-# fine). Mine looks like this:
+# least have a .bashrc file or symlink. This dir will be rsynced to ~ on
+# remote hosts (top level symlinks are resolved) unless the host already
+# has a $SL_FILES_DIR/.bashrc. In that case, we assume it is a host you
+# control and sync files to separately and already has the ~/.bashrc you
+# want. The remote bash will also take its .inputrc config from this
+# folder (default of not existing is fine). Mine looks like this:
# https://iankelling.org/git/?p=distro-setup;a=tree;f=sl/.iank
# SL_INFO_DIR: Environment variable. This folder stores info about what
-# we detected on the remote system and when we last synced. We expect it
-# to exist ahead of time. Sometimes you may want to forget about a
+# we detected on the remote system and when we last synced. It will be created
+# if it does not exist. Sometimes you may want to forget about a
# remote system, you can use sl --rsync, or the function for that slr
# below.
local now args remote dorsync haveinfo tmpa sshinfo tmp tmp2 type info_sec force_rsync sync_dirname
declare -a args tmpa
+ if [[ ! $SL_INFO_DIR || ! $SL_FILES_DIR ]]; then
+ echo error: missing '$SL_' env vars >&2
+ return 1
+ fi
+
sync_dirname=${SL_FILES_DIR##*/}
now=$(date +%s)
fi
if $dorsync || ! $haveinfo; then
sshinfo=$SL_INFO_DIR/$now$type"$remote"
+ [[ -e $SL_INFO_DIR ]] || mkdir -p $SL_INFO_DIR
touch $sshinfo
chmod 666 $sshinfo
fi