From: manu Date: Tue, 20 Oct 2020 12:58:03 +0000 (+0200) Subject: Fixed adding vagrant user to abuild group on Alpine X-Git-Tag: Kea-1.9.1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0465ea02b694f0059b998f296eedac495f5ba321;p=thirdparty%2Fkea.git Fixed adding vagrant user to abuild group on Alpine --- diff --git a/hammer.py b/hammer.py index 5671437212..8db46b7d0d 100755 --- a/hammer.py +++ b/hammer.py @@ -23,6 +23,8 @@ import textwrap import functools import subprocess import multiprocessing +import grp +import pwd try: import urllib.request except: @@ -1400,8 +1402,6 @@ def prepare_system_local(features, check_times): # prepare alpine elif system == 'alpine': - execute('sudo adduser vagrant abuild') - packages = ['gcc', 'g++', 'make', 'autoconf', 'automake', 'libtool', 'openssl-dev', 'boost-libs', 'boost-dev'] @@ -1434,6 +1434,15 @@ def prepare_system_local(features, check_times): execute('sudo apk add log4cplus log4cplus-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted', env=env, timeout=60, check_times=check_times) + # check for existence of 'vagrant' user and 'abuild' group before adding him to the group + try: + pwd.getpwnam('vagrant') + grp.getgrnam('abuild') + except KeyError: + log.info("Can't add 'vagrant' user to 'abuild' group. Vagrant or abuild does not exist.") + else: + execute('sudo adduser vagrant abuild') + else: raise NotImplementedError('no implementation for %s' % system)