2026-01-23 08:55:18 +01:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
|
|
|
|
|
USR_DIR=${1:-"no_dir"}
|
|
|
|
|
[[ $USR_DIR == "no_dir" ]] && \
|
|
|
|
|
echo "usage $0 usr_dir" && \
|
|
|
|
|
exit 1
|
|
|
|
|
USR_DIR=$(realpath $USR_DIR)
|
2026-01-23 09:59:19 +01:00
|
|
|
|
2026-04-01 11:31:10 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
src="${1:-/svr/usr}"
|
|
|
|
|
dst="${2:-/}"
|
|
|
|
|
|
|
|
|
|
src="$(readlink -f "$src")"
|
|
|
|
|
|
|
|
|
|
find "$src" -type f | while IFS= read -r f; do
|
|
|
|
|
rel="${f#$src/}"
|
2026-06-03 18:52:01 +02:00
|
|
|
target="$dst$rel"
|
2026-04-01 11:31:10 +02:00
|
|
|
|
|
|
|
|
# ensure parent dir exists (but never replace dirs)
|
|
|
|
|
mkdir -p "$(dirname "$target")"
|
|
|
|
|
|
|
|
|
|
# if target exists and is a directory → skip
|
|
|
|
|
if [ -d "$target" ]; then
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# replace file or create new symlink
|
|
|
|
|
ln -sf "$f" "$target"
|
|
|
|
|
done
|
2026-01-28 18:08:10 +00:00
|
|
|
|
2026-03-27 12:43:35 +00:00
|
|
|
useradd svr
|
2026-04-01 11:31:10 +02:00
|
|
|
chown -R root:svr /svr
|