lix-os-utilities/softlink.sh

33 lines
579 B
Bash
Executable File

#!/bin/sh
set -e
[ "$1" ] || { echo "usage: softlink.sh <target directory>" && exit 0; }
echo "chrooting into target and setting up softlinks..."
cd "$1"
>"_softlink.sh" cat <<EOF
#!/bin/sh
#if [ "$(ls /boot)" != "" ]; then
# >&2 echo "refusing to overwrite /boot contents!"
# exit 1
#fi
echo "about to softlink..."
deps="\$(lix deps lix-os | cut -d' ' -f1)"
for dep in \$deps; do
echo "linking \$dep"
lix up -f \$dep
done
echo "wiping /boot links."
rm -fr /boot/*
EOF
chmod +x "_softlink.sh"
chin "$1" "./_softlink.sh"
cd - >/dev/null
rm "$1/_softlink.sh"