2023-05-18 17:21:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2023-05-24 18:12:07 +00:00
|
|
|
|
|
|
|
prereqs_dls() {
|
|
|
|
command -v docker 1>/dev/null || perror "Docker is needed, please install it and run again."
|
|
|
|
systemctl is-active docker &>/dev/null || systemctl start docker
|
|
|
|
docker pull $DLS_IMG
|
|
|
|
}
|
|
|
|
|
|
|
|
dir2config() {
|
|
|
|
pinfo "Generating config.yaml from Direktil configuration"
|
|
|
|
docker run --rm --name $D2C_CTR_NAME \
|
|
|
|
-v .:/var/lib/direktil -w /var/lib/direktil \
|
|
|
|
--entrypoint=/bin/dkl-dir2config \
|
|
|
|
$D2C_IMG
|
|
|
|
}
|
2023-05-18 17:21:30 +00:00
|
|
|
|
|
|
|
start_store() {
|
2023-06-08 17:38:17 +00:00
|
|
|
if docker ps|grep " $DLS_CTR_NAME$" &>/dev/null; then
|
2023-05-24 18:12:07 +00:00
|
|
|
pinfo "Container $DLS_CTR_NAME seems already running"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
docker run --rm --name $DLS_CTR_NAME -p 7606:7606 \
|
2023-05-18 17:21:30 +00:00
|
|
|
-e http_proxy=$http_proxy \
|
|
|
|
-e https_proxy=$https_proxy \
|
|
|
|
-e HTTP_PROXY=$HTTP_PROXY \
|
|
|
|
-e HTTPS_PROXY=$HTTPS_PROXY \
|
2023-05-24 18:12:07 +00:00
|
|
|
-v .:/var/lib/direktil \
|
|
|
|
$DLS_IMG &
|
|
|
|
sleep 2
|
2023-05-18 17:21:30 +00:00
|
|
|
}
|
|
|
|
|
2023-05-24 18:12:07 +00:00
|
|
|
source $(dirname $0)/.common
|
|
|
|
check_root
|
2023-05-18 17:21:30 +00:00
|
|
|
prereqs
|
2023-06-14 18:21:23 +00:00
|
|
|
prereqs_dls
|
2023-05-24 18:12:07 +00:00
|
|
|
dir2config
|
2023-05-18 17:21:30 +00:00
|
|
|
start_store
|
|
|
|
unlock_store
|
|
|
|
|