adding docker checks in function file

This commit is contained in:
mudler
2016-02-06 15:28:56 +01:00
parent 34857bb7a3
commit 0aeb135215
3 changed files with 12 additions and 6 deletions
+2 -3
View File
@@ -2,6 +2,7 @@
set -e
ROOT="${ROOT:-$PWD}"
DOCKER_IMAGE="${DOCKER_IMAGE:-sabayon/builder-amd64}"
. /sbin/sabayondevkit-functions.sh
if [ $# -eq 0 ]
then
@@ -9,8 +10,6 @@ if [ $# -eq 0 ]
exit 1
fi
if [ "$(id -u)" != "0" ]; then
echo "!! If you are not running the script as root, your user should be in the docker group to use it. (sudo gpasswd -a $USER docker) !!"
fi
check_docker_requirements
docker run --rm -v "$ROOT"/portage_artifacts:/usr/portage/packages -ti $DOCKER_IMAGE $@
+3 -3
View File
@@ -1,5 +1,7 @@
#!/bin/bash
set -e
. /sbin/sabayondevkit-functions.sh
ROOT="${ROOT:-$PWD}"
entropysrv=$(mktemp)
createrepo=$(mktemp)
@@ -8,9 +10,7 @@ REPOSITORY_DESCRIPTION="${REPOSITORY_DESCRIPTION:-My Sabayon repository}"
DOCKER_IMAGE="${DOCKER_IMAGE:-sabayon/builder-amd64}"
EDITOR=cat
if [ "$(id -u)" != "0" ]; then
echo "!! If you are not running the script as root, your user should be in the docker group to use it. (sudo gpasswd -a $USER docker) !!"
fi
check_docker_requirements
echo "Repository: $REPOSITORY_NAME"
echo "Repository Description: $REPOSITORY_DESCRIPTION"
+7
View File
@@ -1,5 +1,12 @@
#!/bin/bash
check_docker_requirements(){
if [ "$(id -u)" != "0" ]; then
groups | grep -q docker || echo "--> If you are not running the script as root, your user should be in the docker group to use it. (sudo gpasswd -a $USER docker)"
fi
ps aux | grep -q '[d]ocker' || echo "--> Be sure to have the docker daemon running (sudo systemctl start docker)"
}
build() {
local SEARCH=$1
local EMERGE_DEFAULT_ARGS=${2:---accept-properties=-interactive --verbose --oneshot --nospinner --quiet-build=y --quiet-fail --fail-clean=y --complete-graph --buildpkg}