mirror of
https://github.com/SebastianKrupinski/action-stalwart-install.git
synced 2026-04-11 20:55:01 +00:00
fix: use sudo
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
17
action.yml
17
action.yml
@@ -25,10 +25,13 @@ runs:
|
||||
run: |
|
||||
echo "::group::Checking prerequisites"
|
||||
|
||||
# Check if running as root
|
||||
# Check if running as root or if sudo is available
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "::error::This action must run as root. Use 'sudo' or run in a container with root privileges."
|
||||
exit 1
|
||||
if ! command -v sudo &> /dev/null; then
|
||||
echo "::error::This action must run as root or 'sudo' must be available."
|
||||
exit 1
|
||||
fi
|
||||
echo "ℹ Running as non-root user — will use sudo for privileged steps."
|
||||
fi
|
||||
|
||||
# Check for required commands
|
||||
@@ -49,7 +52,9 @@ runs:
|
||||
run: |
|
||||
echo "::group::Installing Stalwart Mail Server"
|
||||
chmod +x "${{ github.action_path }}/scripts/install.sh"
|
||||
"${{ github.action_path }}/scripts/install.sh"
|
||||
SUDO=""
|
||||
if [ "$(id -u)" -ne 0 ]; then SUDO="sudo -E"; fi
|
||||
$SUDO "${{ github.action_path }}/scripts/install.sh"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Configure Stalwart
|
||||
@@ -72,7 +77,9 @@ runs:
|
||||
|
||||
echo "::group::Configuring Stalwart"
|
||||
chmod +x "${{ github.action_path }}/scripts/configure.sh"
|
||||
"${{ github.action_path }}/scripts/configure.sh"
|
||||
SUDO=""
|
||||
if [ "$(id -u)" -ne 0 ]; then SUDO="sudo -E"; fi
|
||||
$SUDO "${{ github.action_path }}/scripts/configure.sh"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Display completion message
|
||||
|
||||
Reference in New Issue
Block a user