WIP add a Docker-based test env
[plcapi.git] / tests / ci / setup / create_user.sh
1 #!/bin/sh
2
3 # @todo set up the same user for running tests as on travis (ie. 'travis'), or maybe user 'user' ?
4 # @todo make the GID & UID of the user variable
5
6 set -e
7
8 USERNAME="${1:-test}"
9
10 addgroup --gid 1013 ${USERNAME}
11 adduser --system --uid=1013 --gid=1013 --home /home/${USERNAME} --shell /bin/bash ${USERNAME}
12 adduser ${USERNAME} ${USERNAME}
13
14 mkdir -p /home/${USERNAME}/.ssh
15 cp /etc/skel/.[!.]* /home/${USERNAME}
16
17 adduser ${USERNAME} sudo
18 sed -i "\$ a ${USERNAME}   ALL=\(ALL:ALL\) NOPASSWD: ALL" /etc/sudoers
19
20 chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}