Code Review
/
releng
/
global-jjb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
CI: Change conclusion getter
[releng/global-jjb.git]
/
jenkins-init-scripts
/
create-jenkins-user.sh
diff --git
a/jenkins-init-scripts/create-jenkins-user.sh
b/jenkins-init-scripts/create-jenkins-user.sh
index
0005244
..
980eacf
100755
(executable)
--- a/
jenkins-init-scripts/create-jenkins-user.sh
+++ b/
jenkins-init-scripts/create-jenkins-user.sh
@@
-12,10
+12,10
@@
OS=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
OS_RELEASE=$(facter lsbdistrelease | tr '[:upper:]' '[:lower:]')
OS=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
OS_RELEASE=$(facter lsbdistrelease | tr '[:upper:]' '[:lower:]')
-if [[ "$OS_RELEASE" == "18.04"
]] && [[ "$OS" == 'ubuntu' ]]
-then
- echo 'PATH=$HOME/.local/bin:$PATH
-
export
PATH' >> /etc/profile
+if [[ "$OS_RELEASE" == "18.04"
&& "$OS" == 'ubuntu' ]]; then
+ # We do not want var expansion here as profile script expands at runtime.
+ # shellcheck disable=SC2016
+
echo 'export PATH=$HOME/.local/bin:$
PATH' >> /etc/profile
fi
useradd -m -s /bin/bash jenkins
fi
useradd -m -s /bin/bash jenkins
@@
-29,10
+29,15
@@
if grep -q mock /etc/group; then
usermod -a -G mock jenkins
fi
usermod -a -G mock jenkins
fi
-mkdir /home/jenkins/.ssh /w
-cp -r "/home/${OS}/.ssh/authorized_keys" /home/jenkins/.ssh/authorized_keys
+mkdir /home/jenkins/.ssh
+cp "/home/${OS}/.ssh/authorized_keys" /home/jenkins/.ssh/authorized_keys
+chmod 0600 /home/jenkins/.ssh/authorized_keys
# Generate ssh key for use by Robot jobs
echo -e 'y\n' | ssh-keygen -N "" -f /home/jenkins/.ssh/id_rsa -t rsa
# Generate ssh key for use by Robot jobs
echo -e 'y\n' | ssh-keygen -N "" -f /home/jenkins/.ssh/id_rsa -t rsa
-chown -R jenkins:jenkins /home/jenkins/.ssh /w
-chmod 700 /home/jenkins/.ssh
+chown -R jenkins:jenkins /home/jenkins/.ssh
+chmod 0700 /home/jenkins/.ssh
+
+# The '/w' volume may already be part of image
+[[ ! -d '/w' ]] && mkdir /w
+chown -R jenkins:jenkins /w