Made requested changes by TB
This commit is contained in:
parent
a3f9dc64b7
commit
fe0e1ce5d2
|
@ -1,15 +1,29 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
echo "This script add's a user with password to the bridghead"
|
echo "This script add's a user with password to the bridghead"
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "No arguments provided, please provide the prject name"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f /etc/systemd/system/bridgehead@$1.service.d/override.conf ]; then
|
||||||
|
echo "Please create a Service first, with setup-bridgehead-units.sh"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
read -p 'Username: ' bc_user
|
read -p 'Username: ' bc_user
|
||||||
read -sp 'Password: ' bc_password
|
read -sp 'Password: ' bc_password
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
bc=$(docker run --rm -ti xmartlabs/htpasswd $bc_user $bc_password)
|
|
||||||
|
|
||||||
if [ -z $bc_auth_users ]; then
|
bc=`docker run --rm -it httpd:latest htpasswd -nb $bc_user $bc_password`
|
||||||
printf "Please run: export bc_auth_users=\"%q\"" $bc
|
|
||||||
else
|
if grep -q -E "Environment=bc_auth_users=" /etc/systemd/system/bridgehead@$1.service.d/override.conf ; then
|
||||||
echo "Please run: export bc_auth_users=\"${bc},$bc_auth_users\""
|
x=`grep -E "Environment=bc_auth_users=" /etc/systemd/system/bridgehead@$1.service.d/override.conf`
|
||||||
|
sed -i "/Environment=bc_auth_users=/c\\$x,$bc" /etc/systemd/system/bridgehead@$1.service.d/override.conf
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Environment=bc_auth_users=${bc}" >> /etc/systemd/system/bridgehead@$1.service.d/override.conf
|
||||||
fi
|
fi
|
|
@ -1,6 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
### Note: Currently not complete, needs some features before useable for production
|
### Note: Currently not complete, needs some features before useable for production
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "No arguments provided"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
source lib/functions.sh
|
source lib/functions.sh
|
||||||
|
|
||||||
if ! lib/prerequisites.sh; then
|
if ! lib/prerequisites.sh; then
|
||||||
|
|
Loading…
Reference in New Issue