summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs/services/dnbd3-generator.sh
blob: bb9e7ad593686e704720f20103729490c9ec8c8f (plain) (blame)
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
28
29
30
#!/bin/sh
GENERATOR_DIR="$2"
[ -z "$GENERATOR_DIR" ] && exit 1
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
#GENERATOR_DIR="/run/systemd/generator/"
{
    echo "[Unit]"
    echo "Description=root fs on dnbd3 (distributed network block device)"
    echo "After=dracut-initqueue.service network.target"
    echo "Before=dracut-mount.service"
    echo "DefaultDependencies=no"
    echo "IgnoreOnIsolate=true"
    echo "#Conflicts=shutdown.target"
    echo "#ConditionKernelCommandLine=!"
    echo "#ConditionPathExists=/etc/multipath.conf"
    echo ""
    echo "[Service]"
    echo "Type=oneshot"
    echo "RemainAfterExit=true"
    echo "KillMode=none"
    echo "ExecStartPre=/sbin/fetch-config"
    echo "ExecStart=/sbin/dnbd3root"
    echo "#ExecReload=/sbin/multipathd reconfigure"
    echo "#ExecStop=echo 'stopping dnbd3'"
} > "$GENERATOR_DIR"/dnbd3root.service
[ -d "$GENERATOR_DIR"/sysinit.target.wants ] || mkdir -p "$GENERATOR_DIR"/sysinit.target.wants
ln -s ../dnbd3root.service "$GENERATOR_DIR"/sysinit.target.wants/dnbd3root.service
[ -d "$GENERATOR_DIR"/remote-fs.target.wants ] || mkdir -p "$GENERATOR_DIR"/remote-fs.target.wants
ln -s ../dnbd3root.service "$GENERATOR_DIR"/remote-fs.target.wants/dnbd3root.service
exit 0