workspaces/.bin/create-home-tarball.sh

19 lines
598 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if [ "$(basename "$(pwd -P)")" != "workspaces" ]; then
echo "Error: this script must be run from a directory named 'workspaces', not '$(basename "$(pwd -P)")'" >&2
exit 1
fi
replace_home() {
sed -i "s|$1|$2|g" .config/fish/fish_variables
find .local/share/nvim/mason/packages -type f -exec sed -i "s|$1|$2|g" {} +
}
find .config -type d -exec chmod g+x {} +
replace_home "$PWD" "/home/devuser"
tar -czf home.tar.gz --owner root:0 --group secproc:1002 --xform "s,$PWD,/home/devuser," .config .local .ssh start.sh
replace_home "/home/devuser" "$PWD"