merge upstream phpxmlrpc
[plcapi.git] / php / phpxmlrpc / tests / ci / setup / create_user.sh
1 #!/bin/sh
2
3 # @todo make the GID & UID of the user variable (we picked 2000 as it is the one used by default by Travis)
4
5 set -e
6
7 USERNAME="${1:-docker}"
8
9 addgroup --gid 2000 "${USERNAME}"
10 adduser --system --uid=2000 --gid=2000 --home "/home/${USERNAME}" --shell /bin/bash "${USERNAME}"
11 adduser "${USERNAME}" "${USERNAME}"
12
13 mkdir -p "/home/${USERNAME}/.ssh"
14 cp /etc/skel/.[!.]* "/home/${USERNAME}"
15
16 chown -R "${USERNAME}:${USERNAME}" "/home/${USERNAME}"
17
18 if [ -f /etc/sudoers ]; then
19     adduser "${USERNAME}" sudo
20     sed -i "\$ a ${USERNAME}   ALL=\(ALL:ALL\) NOPASSWD: ALL" /etc/sudoers
21 fi