Skip to content

Commit 2589e7b

Browse files
authored
feat(qbm-update): enhance checking for user and group; improve messaging
output name not id
1 parent 993dc1f commit 2589e7b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

qbm-update.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ QBM_SERVICE_NAME="qbmanage"
1111
QBM_UPSTREAM_GIT_REMOTE="origin"
1212
QBM_VERSION_FILE="$QBM_PATH/VERSION"
1313
QBM_REQUIREMENTS_FILE="$QBM_PATH/requirements.txt"
14-
CURRENT_UID=$(id -u)
14+
CURRENT_UID=$(id -un)
1515

1616
# Check if QBM is installed and if the current user owns it
1717
check_qbm_installation() {
1818
if [ -d "$QBM_PATH" ]; then
19-
qbm_repo_owner=$(stat -c '%u' "$QBM_PATH")
19+
qbm_repo_owner=$(stat --format='%U' "$QBM_PATH")
20+
qbm_repo_group=$(stat --format='%G' "$QBM_PATH")
2021
if [ "$qbm_repo_owner" != "$CURRENT_UID" ]; then
2122
echo "You do not own the QbitManage repo. Please run this script as the user that owns the repo [$qbm_repo_owner]."
23+
echo "use 'sudo -u $qbm_repo_owner -g $qbm_repo_group qbm-update'"
2224
exit 1
2325
fi
2426
else

0 commit comments

Comments
 (0)