harbor/tools/ova/script/firstboot.sh

60 lines
1.3 KiB
Bash
Raw Normal View History

2016-10-25 12:09:54 +02:00
#!/bin/bash
set -e
echo "======================= $(date)====================="
export PATH=$PATH:/usr/local/bin
base_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $base_dir/common.sh
#Reset root password
value=$(ovfenv -k root_pwd)
if [ -n "$value" ]
then
echo "Resetting root password..."
printf "$value\n$value\n" | passwd root
fi
#configure SSH
configSSH
2016-10-25 12:09:54 +02:00
#echo "Adding rules to iptables..."
addIptableRules
2016-10-25 12:09:54 +02:00
echo "Installing docker compose..."
installDockerCompose
echo "Starting docker service..."
systemctl start docker
echo "Uncompress Harbor offline instaler tar..."
tar -zxvf $base_dir/../harbor-offline-installer*.tgz -C $base_dir/../
echo "Loading images..."
load
echo "Configuring Harbor..."
chmod 600 $base_dir/../harbor/harbor.cfg
2016-11-10 09:18:13 +01:00
#Configure authentication mode
echo "Read attribute using ovfenv: [ auth_mode ]"
auth_mode=$(ovfenv -k auth_mode)
if [ -n "$auth_mode" ]
then
sed -i -r s%"#?auth_mode\s*=\s*.*"%"auth_mode = $auth_mode"% $base_dir/../harbor/harbor.cfg
fi
2016-11-16 11:49:09 +01:00
#Configure other attrs
mkdir -p /data/cert/
2016-10-25 12:09:54 +02:00
configure
#Start Harbor
echo "Starting Harbor..."
up
2016-11-10 08:11:29 +01:00
echo "Removing unneeded installation packages..."
rm $base_dir/../harbor-offline-installer*.tgz
rm $base_dir/../harbor/harbor*.tgz
2016-10-25 12:09:54 +02:00
echo "===================================================="