2787767bf0
'set -e' flag doesn't allow to fall back to 'return 0' when a command fails. As installation/removal should not fail in most cases - 'set -e' flag has been removed. Below page recommends to be careful with 'set -e' usage: https://www.debian.org/doc/debian-policy/ch-opersys.html#writing-the-scripts Change-Id: If4439aaff66747bceabd3beb7e00ae12ce950e43 Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
53 lines
1.1 KiB
Bash
Executable File
53 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This will return 0 if an id is created and non-zero if
|
|
# it already exists
|
|
# https://www.debian.org/doc/debian-policy/ch-opersys.html#users-and-groups
|
|
do_create_rdc_user() {
|
|
adduser \
|
|
--system \
|
|
--quiet \
|
|
--home /nonexistent \
|
|
--no-create-home \
|
|
--disabled-password \
|
|
rdc
|
|
if [ $(getent group render) ]; then
|
|
usermod -a -G render rdc
|
|
else
|
|
usermod -a -G video rdc
|
|
fi
|
|
# Make sure this doesn't return non-zero if an id already exists
|
|
return 0
|
|
}
|
|
|
|
create_rdc_service() {
|
|
#Symlink RDC Service
|
|
if [ -d /run/systemd/system ]; then
|
|
ln -s -f -r /@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/rdc/rdc.service /lib/systemd/system/rdc.service
|
|
fi
|
|
}
|
|
|
|
reload_systemd() {
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
configure)
|
|
do_create_rdc_user
|
|
create_rdc_service
|
|
reload_systemd
|
|
exit 0
|
|
;;
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
echo "$1"
|
|
;;
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|
|
|