File: 20-install-init-scripts

package info (click to toggle)
python-diskimage-builder 2.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,848 kB
  • sloc: sh: 6,948; python: 3,271; makefile: 42
file content (27 lines) | stat: -rwxr-xr-x 781 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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

scripts_dir="$(dirname $0)/../init-scripts/$DIB_INIT_SYSTEM/"
if [ -d "$scripts_dir" ]; then
    dest=
    case $DIB_INIT_SYSTEM in
        upstart) dest=/etc/init/ ;;
        openrc) dest=/etc/init.d/ ;;
        systemd) dest=/usr/lib/systemd/system/ ;;
        sysv) dest=/etc/init.d/ ;;
    esac

    if [ -z "$dest" ]; then
        echo "ERROR: DIB_INIT_SYSTEM ($DIB_INIT_SYSTEM) is not a known type"
        exit 1
    fi
    cp -RP $scripts_dir. $dest || true
fi