mirror of
https://github.com/abraunegg/onedrive
synced 2024-04-28 12:12:51 +02:00
7cf2912d2d
* Move lots of stuff into contrib directory to clean up root folder * Update autoconf files for new location of some files * Refactor README split and move to docs directory * Update INSTALL.md * Update Makefile.in * Install docs from new location * Uninstall docs correctly * Update Dockerfile * Fix up Dockerfile spacing * Move systemd stuff to contrib * Move docker specific stuff to contrib/docker, update docs * Fix Alpine and Stretch docker files * Update configure after changed file locations * Update INSTALL.md to include pkg-config as requirement * Move also entrypoint.sh to contrib/docker * Update 'min-notif-changes' to 'min-notify-changes' which was missed in PR #467 * Update to add --sync-root-files to usage.md and man page * Update usage.md to include --auth-files ARG details
36 lines
902 B
Bash
Executable file
36 lines
902 B
Bash
Executable file
#!/bin/bash -eu
|
|
|
|
set +H -xeuo pipefail
|
|
|
|
ONEDRIVE_UID=$(stat /onedrive/data -c '%u')
|
|
ONEDRIVE_GID=$(stat /onedrive/data -c '%g')
|
|
|
|
# Create new group using target GID
|
|
if ! odgroup="$(getent group $ONEDRIVE_GID)"; then
|
|
odgroup='onedrive'
|
|
groupadd "${odgroup}" -g $ONEDRIVE_GID
|
|
else
|
|
odgroup=${odgroup%%:*}
|
|
fi
|
|
|
|
# Create new user using target UID
|
|
if ! oduser="$(getent passwd $ONEDRIVE_UID)"; then
|
|
oduser='onedrive'
|
|
useradd "${oduser}" -u $ONEDRIVE_UID -g $ONEDRIVE_GID
|
|
else
|
|
oduser="${oduser%%:*}"
|
|
usermod -g "${odgroup}" "${oduser}"
|
|
grep -qv root <( groups "${oduser}" ) || { echo 'ROOT level priviledges prohibited!'; exit 1; }
|
|
fi
|
|
|
|
chown "${oduser}:${odgroup}" /onedrive/ /onedrive/conf
|
|
|
|
# Default parameters
|
|
ARGS=(--monitor --verbose --confdir /onedrive/conf --syncdir /onedrive/data)
|
|
|
|
if [ ${#} -gt 0 ]; then
|
|
ARGS=("${@}")
|
|
fi
|
|
|
|
exec gosu "${oduser}" /usr/local/bin/onedrive "${ARGS[@]}"
|