Skip to content

Commit daf6d5c

Browse files
committed
chore: simply amp user and group creation
1 parent 478260e commit daf6d5c

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

scripts/apps/uptime-kuma-2/ampstart.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@ ln -s /etc/machine-id /var/lib/dbus/machine-id
2020

2121
echo "[Info] Setting up amp user and group..."
2222

23-
if ! getent group "${AMPGROUPID}" >/dev/null; then
24-
if getent group amp >/dev/null; then
25-
groupmod -o -g "${AMPGROUPID}" amp
26-
else
27-
groupadd -r -g "${AMPGROUPID}" amp
28-
fi
23+
if getent group amp >/dev/null; then
24+
groupmod -o -g "${AMPGROUPID}" amp
25+
else
26+
groupadd -r -o -g "${AMPGROUPID}" amp
2927
fi
3028

3129
if id amp &>/dev/null; then
3230
usermod -o -u "${AMPUSERID}" -g "${AMPGROUPID}" amp
3331
else
3432
useradd -m -d /home/amp -s /bin/bash -c "AMP Process User" \
35-
-u "${AMPUSERID}" -g "${AMPGROUPID}" amp
33+
-o -u "${AMPUSERID}" -g "${AMPGROUPID}" amp
3634
fi
3735

3836
getent group tty >/dev/null && usermod -aG tty amp
@@ -72,7 +70,7 @@ if [[ -n "${AMP_MOUNTPOINTS:-}" ]]; then
7270
for dir in "${dirs[@]}"; do
7371
[[ -n "${dir}" ]] || continue
7472
if [[ -e "${dir}" ]]; then
75-
chown -R amp:"${AMPGROUPID}" "${dir}" 2>/dev/null || echo "[Warn] chown failed for ${dir}; continuing"
73+
chown -R amp:amp "${dir}" 2>/dev/null || echo "[Warn] chown failed for ${dir}; continuing"
7674
else
7775
echo "[Warn] Mountpoint not found: ${dir}; skipping"
7876
fi

scripts/base/ampstart.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@ ln -s /etc/machine-id /var/lib/dbus/machine-id
2020

2121
echo "[Info] Setting up amp user and group..."
2222

23-
if ! getent group "${AMPGROUPID}" >/dev/null; then
24-
if getent group amp >/dev/null; then
25-
groupmod -o -g "${AMPGROUPID}" amp
26-
else
27-
groupadd -r -g "${AMPGROUPID}" amp
28-
fi
23+
if getent group amp >/dev/null; then
24+
groupmod -o -g "${AMPGROUPID}" amp
25+
else
26+
groupadd -r -o -g "${AMPGROUPID}" amp
2927
fi
3028

3129
if id amp &>/dev/null; then
3230
usermod -o -u "${AMPUSERID}" -g "${AMPGROUPID}" amp
3331
else
3432
useradd -m -d /home/amp -s /bin/bash -c "AMP Process User" \
35-
-u "${AMPUSERID}" -g "${AMPGROUPID}" amp
33+
-o -u "${AMPUSERID}" -g "${AMPGROUPID}" amp
3634
fi
3735

3836
getent group tty >/dev/null && usermod -aG tty amp
@@ -72,7 +70,7 @@ if [[ -n "${AMP_MOUNTPOINTS:-}" ]]; then
7270
for dir in "${dirs[@]}"; do
7371
[[ -n "${dir}" ]] || continue
7472
if [[ -e "${dir}" ]]; then
75-
chown -R amp:"${AMPGROUPID}" "${dir}" 2>/dev/null || echo "[Warn] chown failed for ${dir}; continuing"
73+
chown -R amp:amp "${dir}" 2>/dev/null || echo "[Warn] chown failed for ${dir}; continuing"
7674
else
7775
echo "[Warn] Mountpoint not found: ${dir}; skipping"
7876
fi

0 commit comments

Comments
 (0)