Make sure both /etc/bridgehead and /srv/docker/bridgehead are owned by the correct user.

This commit is contained in:
Martin Lablans 2022-05-16 09:46:03 +02:00
parent d23e15d1d8
commit e3e83dd886
1 changed files with 12 additions and 6 deletions

View File

@ -2,16 +2,22 @@
source lib/functions.sh
checkOwner(){
## Check for file permissions
COUNT=$(find $1 ! -user $2 |wc -l)
if [ $COUNT -gt 0 ]; then
log ERROR "$COUNT files in $1 are not owned by user $2. Run find $1 ! -user $2 to see them, chown -R $2 $1 to correct this issue."
exit 1
fi
}
if ! id "bridgehead" &>/dev/null; then
log ERROR "User bridgehead does not exist. Please consult readme for installation."
exit 1
fi
COUNT=$(find . ! -user bridgehead |wc -l)
if [ $COUNT -gt 0 ]; then
log ERROR "$COUNT files in $(pwd) are not owned by user bridgehead. Run find $(pwd) ! -user bridgehead to see them, chown -R bridgehead $(pwd) to correct this issue."
exit 1
fi
checkOwner . bridgehead
checkOwner /etc/bridgehead bridgehead
## Check if user is a su
log INFO "Checking if all prerequisites are met ..."