diff --git a/src/main/deb/postinst b/src/main/deb/postinst index 7e589096..779e71ec 100644 --- a/src/main/deb/postinst +++ b/src/main/deb/postinst @@ -1,6 +1,20 @@ chmod 755 ${config.installDir}/lib/download.sh ${config.installDir}/lib/download.sh ${config.installDir}/lib/ /usr/share/java/r2cloud/ +if id "${config.user}" &>/dev/null; then + echo "User '${config.user}' already exists." +else + useradd -m ${config.user} + echo "User '${config.user}' created." + + if ! getent group ${config.group} > /dev/null; then + groupadd ${config.group} + echo "Group '${config.group}' created." + fi + + usermod -aG dialout,plugdev ${config.user} +fi + chown -R ${config.user}:${config.group} ${config.installDir} /usr/share/java/r2cloud/*.jar chmod 640 ${config.installDir}/lib/*.jar /usr/share/java/r2cloud/*.jar