I created a .deb package with fpm. The package is very simple as it simply runs a docker-compose over this docker-compose.yml file.
The package is composed of 3 files:
.
├── diagnosticator
├── diagnosticator.1
└── docker-compose.yml
The permissions on diagnosticator are as follows:
-rw-rw-r-- 1 enrico enrico 554 feb 12 21:23 diagnosticator
Here is my diagnosticator script, that simply needs to run the docker-compose.yml:
#!/usr/bin/env bash
#
# == diagnosticator 0.1.0 ==
#
DOCKER_COMPOSE_FILE=/usr/lib/diagnosticator/docker-compose.yml
if [ -s $DOCKER_COMPOSE_FILE ]; then
docker-compose pull && docker-compose up
else
echo ' !!! ERROR !!!'
echo ' ---> missing docker-compose.yml <--- '
fi
exit 0
and here the fpm command used to build it:
fpm \
-s dir -t deb \
--deb-use-file-permissions \
-p diagnosticator-0.1.0-1-any.deb \
--name diagnosticator \
--license agpl3 \
--version 0.1.0 \
--architecture all \
--depends bash \
--description "Diagnosticator local app" \
--url "https://diagnosticator.com" \
--maintainer "Enrico Cocchi" \
diagnosticator=/usr/bin/diagnosticator diagnosticator.1=/usr/share/man/man1/diagnosticator.1 docker-compose.yml=/usr/lib/diagnosticator/docker-compose.yml
When I sudo dpkg -i diagnosticator-0.1.0-1-any.deb everything works fine and files get placed where they should, but if I try to run it (with and without sudo):
$ diagnosticator
bash: /usr/bin/diagnosticator: Permission denied
$ sudo diagnosticator
sudo: diagnosticator: command not found
I'd like users to be able to run it without sudo. I tried to google and search here for any solutions but I could not find any. Does anybody know what am I doing wrong here?