52 lines
1.6 KiB
Bash
Executable File
52 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
[ "$1" ] || { echo "usage: install.sh <target directory>" && exit 0; }
|
|
|
|
lixmnt="$(mktemp -d)"
|
|
trap 'trap - INT; kill -s INT "$$"; rmdir "$lixmnt"' INT
|
|
trap 'rmdir "$lixmnt"' EXIT
|
|
|
|
echo "pulling the lix-os package..."
|
|
lix pull lix-os
|
|
|
|
echo "transferring lix-os dependency chroot contents to target..."
|
|
lix deps lix-os | awk '{ print "lix/" $1 "/" $2 "/fs" }' | while read layer; do
|
|
echo "copying from $layer"
|
|
rsync -ah --info=progress2 --force "$(lyr upperdir $layer)/" "$1/"
|
|
done
|
|
|
|
## below is the old way this was done. this required a custom "mount" binary.
|
|
## works fine in lix os, but not in host distributions used for bootstrapping.
|
|
## lix os' mount sets aside a whopping 8KiB for the option string. if the
|
|
## option string is too long for the memory set aside, the "mount"
|
|
## implementations the author has used fail silently!
|
|
#echo "transferring lix-os chroot contents to target..."
|
|
#lix mount "$lixmnt" lix-os
|
|
#rsync -ah --info=progress2 --force "$lixmnt/" "$1/"
|
|
#lix umount "$lixmnt" lix-os
|
|
#umount "$lixmnt"
|
|
|
|
transfer() {
|
|
if [ -d "$1" ]; then
|
|
mkdir -p "$2"
|
|
rsync -ah --info=progress2 --force "$1" "$2"
|
|
else
|
|
echo "unable to find $1! transfer manually before proceeding..." >&2
|
|
fi
|
|
}
|
|
|
|
echo "transferring lyr state to target..."
|
|
transfer "/usr/var/lyr/" "$1/var/lyr/"
|
|
|
|
echo "transferring src state to target..."
|
|
transfer "/usr/var/src/" "$1/var/src/"
|
|
|
|
echo "transferring src state to target..."
|
|
transfer "/usr/var/src/" "$1/var/src/"
|
|
|
|
echo "removing LICENSE and README in target system root..."
|
|
[ ! -f "$1/LICENSE" ] || rm "$1/LICENSE"
|
|
[ ! -f "$1/README" ] || rm "$1/README"
|