summaryrefslogtreecommitdiff
path: root/grid5000/steps/data/setup/puppet/modules/env/files/std/g5k_generator/g5k_generator
blob: 675df66c112e8d478e7e3f69cc4b7901e7311f0e (plain)
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
31
32
33
34
35
36
37
38
#!/bin/bash

#for tests
DEST=/tmp

# Standard generator setup, they take three arguments but allow none too.
if [[ $# -gt 0 && $# -ne 3 ]]; then
    echo "This program takes three or no arguments."
    exit 0
fi

# See https://www.freedesktop.org/wiki/Software/systemd/Generators/
# Using $2 to override generated services by systemd-sysv-generator in $3
DEST="$2"

##### Disable the Dell dataeng service if not a Dell Machine #####

SMBIOS_UTIL="/usr/sbin/smbios-sys-info-lite"

if [[ ! -x "$SMBIOS_UTIL" ]];
then
    echo "G5k systemd generator, ${SMBIOS_UTIL} cannot be executed" > /dev/kmsg
    exit 0
fi

#Simple check, copied from Dell tools (CheckSystemType).
"$SMBIOS_UTIL" | /bin/egrep "(Vendor|OEM String 1)" | /usr/bin/awk -F":" '{print $2}' | /bin/grep -qi "Dell"

if [[ "$?" != "0" ]]; then
    /bin/ln -sf "/dev/null" "${DEST}/dataeng.service"
else
    #Remove possibly existing symlink
    /bin/rm -f "${DEST}/dataeng.service"
fi

##### End dataeng service override #####

exit 0