install: DataStorage D:\Dropbox, create workdir, git bootstrap

Windows bootstrap.ps1 and Linux install.sh clone public Gitea repos,
build the fork, enable logon + 15-min bisync.
This commit is contained in:
2026-09-10 00:38:07 +02:00
parent 9b5356d0ab
commit f517cbd7ed
5 changed files with 240 additions and 24 deletions
+116
View File
@@ -0,0 +1,116 @@
#!/usr/bin/env bash
# rclone-dropbox-bisync Linux setup
# Dual-boot: NTFS volume labeled DataStorage, Dropbox at <mount>/Dropbox
# Paste: curl -fsSL https://git.denkena-consulting.com/f-denkena/rclone-dropbox-bisync/raw/branch/master/linux/install.sh | bash
set -euo pipefail
GIT_BASE='https://git.denkena-consulting.com/f-denkena'
PACK_REPO="$GIT_BASE/rclone-dropbox-bisync.git"
RCLONE_REPO="$GIT_BASE/rclone.git"
SRC="${XDG_CACHE_HOME:-$HOME/.cache}/rclone-dropbox-bisync/src"
BIN="$HOME/.local/bin"
CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/rclone-dropbox-bisync"
UNIT_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
find_datastorage() {
local m
if command -v findmnt >/dev/null 2>&1; then
m=$(findmnt -n -o TARGET -S LABEL=DataStorage 2>/dev/null | head -1 || true)
if [ -n "$m" ]; then
echo "$m"
return
fi
fi
for m in /mnt/DataStorage /media/"$USER"/DataStorage /run/media/"$USER"/DataStorage /d /mnt/d /mnt/data; do
if [ -d "$m/Dropbox" ]; then
echo "$m"
return
fi
done
return 1
}
need() {
command -v "$1" >/dev/null 2>&1
}
if ! need git; then
echo "install git first" >&2
exit 1
fi
if ! need go; then
echo "install go first (needed to build the forked rclone)" >&2
exit 1
fi
VOL=$(find_datastorage) || {
echo "NTFS volume LABEL=DataStorage (or .../Dropbox) not mounted" >&2
exit 1
}
DROPBOX="$VOL/Dropbox"
WORKDIR="$VOL/rclone-bisync"
[ -d "$DROPBOX" ] || {
echo "missing $DROPBOX" >&2
exit 1
}
mkdir -p "$WORKDIR" "$SRC" "$BIN" "$CFG_DIR" "$UNIT_DIR" "$HOME/.config/autostart"
[ -f "$DROPBOX/RCLONE_TEST" ] || : >"$DROPBOX/RCLONE_TEST"
if [ ! -d "$SRC/packaging/.git" ]; then
git clone --depth 1 "$PACK_REPO" "$SRC/packaging"
else
git -C "$SRC/packaging" pull --ff-only
fi
if [ ! -d "$SRC/rclone/.git" ]; then
git clone --depth 1 --branch bisync-delta-list "$RCLONE_REPO" "$SRC/rclone"
else
git -C "$SRC/rclone" fetch origin bisync-delta-list
git -C "$SRC/rclone" checkout bisync-delta-list
git -C "$SRC/rclone" pull --ff-only
fi
export CGO_ENABLED=0
echo "building rclone..."
(cd "$SRC/rclone" && go build -trimpath -o "$BIN/rclone" .)
echo "building rclone-bisyncd..."
(cd "$SRC/packaging/cmd/rclone-bisyncd" && go build -trimpath -o "$BIN/rclone-bisyncd" .)
cat >"$CFG_DIR/config.json" <<EOF
{
"enabled": true,
"path1": "$DROPBOX",
"path2": "dropbox:",
"workdir": "$WORKDIR",
"interval_minutes": 15,
"rclone": "$BIN/rclone",
"check_filename": "RCLONE_TEST"
}
EOF
install -m 644 "$SRC/packaging/linux/systemd/rclone-bisync.service" "$UNIT_DIR/rclone-bisync.service"
install -m 644 "$SRC/packaging/linux/systemd/rclone-bisync.timer" "$UNIT_DIR/rclone-bisync.timer"
# Point units at user binaries
sed -i "s|^ExecStart=.*|ExecStart=$BIN/rclone-bisyncd --once|" "$UNIT_DIR/rclone-bisync.service"
# Startup: enable timer + one-shot after login
cat >"$HOME/.config/autostart/rclone-bisync.desktop" <<EOF
[Desktop Entry]
Type=Application
Name=rclone Dropbox bisync
Exec=sh -c 'systemctl --user start rclone-bisync.service; systemctl --user enable --now rclone-bisync.timer'
X-GNOME-Autostart-enabled=true
Terminal=false
EOF
systemctl --user daemon-reload
systemctl --user enable --now rclone-bisync.timer
systemctl --user start rclone-bisync.service || true
case ":$PATH:" in
*:$BIN:*) ;;
*) echo "Add $BIN to PATH (e.g. export PATH=\"$BIN:\$PATH\" in ~/.profile)" ;;
esac
echo "Configured path1=$DROPBOX workdir=$WORKDIR (volume DataStorage)"
echo "Startup: autostart desktop + systemd --user timer every 15 min"
echo "Put RCLONE_TEST on dropbox: as well. Remote dropbox: must exist in rclone.conf."