diff options
author | Xiang W <wxjstz@126.com> | 2023-12-19 13:20:13 +0000 |
---|---|---|
committer | Rosen Penev <rosenp@gmail.com> | 2024-01-02 15:25:19 -0800 |
commit | ed41a9d8508639c25cbceb9639ee6a08ee467b93 (patch) | |
tree | d315cfe35a8ee6b9823b2a21c438bc547942f467 /utils/syncthing/files | |
parent | f74b43709a26c44f99529352ee3b1d9631945489 (diff) |
syncthing: fix wrong group name in syncthing.init
The group does not always have the same name as user, and when I try
to run syncthing with nobody I get an error. Since nobody belongs to
the group nogroup, I added some code to find out which group user
belongs to.
Signed-off-by: Xiang W <wxjstz@126.com>
Diffstat (limited to 'utils/syncthing/files')
-rw-r--r-- | utils/syncthing/files/syncthing.init | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/utils/syncthing/files/syncthing.init b/utils/syncthing/files/syncthing.init index 7bcb90dae..9fa1ddf40 100644 --- a/utils/syncthing/files/syncthing.init +++ b/utils/syncthing/files/syncthing.init @@ -55,6 +55,8 @@ start_service() { config_load "syncthing" + local group=$(id -gn $user) + # Some of the default values below might not match the defaults # in /etc/config/syncthing: the reason is to remain backwards # compatible with the older versions of this service as it @@ -67,12 +69,12 @@ start_service() { [ -d "$IDX_DB" ] || mkdir -p "$IDX_DB" # A separate step to handle an upgrade use case - [ -d "$IDX_DB" ] && chown -R $user:$user "$IDX_DB" + [ -d "$IDX_DB" ] && chown -R $user:$group "$IDX_DB" fi [ -d "$home" ] || mkdir -p "$home" # A separate step to handle an upgrade use case - [ -d "$home" ] && chown -R $user:$user "$home" + [ -d "$home" ] && chown -R $user:$group "$home" # Changes to "niceness"/macprocs are not picked up by "reload_config" # nor by "restart": the service has to be stopped/started |