2015-06-16 18:11:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Note that this relies on the detail that all elements share one dir inside
|
|
|
|
# the chroot. This will copy all the files that elements have added to
|
|
|
|
# element/static into the image. Mode, symlinks etc will be respected.
|
|
|
|
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2015-08-14 14:40:59 +00:00
|
|
|
scripts_dir="$(dirname $0)/../init-scripts/$DIB_INIT_SYSTEM/"
|
2015-06-16 18:11:22 +00:00
|
|
|
if [ -d "$scripts_dir" ]; then
|
|
|
|
dest=
|
|
|
|
case $DIB_INIT_SYSTEM in
|
|
|
|
upstart) dest=/etc/init/ ;;
|
2016-01-28 21:53:13 +00:00
|
|
|
openrc) dest=/etc/init.d/ ;;
|
2015-06-16 18:11:22 +00:00
|
|
|
systemd) dest=/usr/lib/systemd/system/ ;;
|
|
|
|
sysv) dest=/etc/init.d/ ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -z "$dest" ]; then
|
2016-01-28 21:53:13 +00:00
|
|
|
echo "ERROR: DIB_INIT_SYSTEM ($DIB_INIT_SYSTEM) is not a known type"
|
2015-06-16 18:11:22 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2015-08-14 14:40:59 +00:00
|
|
|
cp -RP $scripts_dir. $dest || true
|
2015-06-16 18:11:22 +00:00
|
|
|
fi
|