start
This commit is contained in:
63
commands/init.sh
Executable file
63
commands/init.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#! /bin/bash
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd)"
|
||||
cd "$SCRIPT_DIR" || exit 1
|
||||
|
||||
# write new secret:
|
||||
if [[ -f "secret" ]]; then
|
||||
echo "Secret found..." >&2
|
||||
else
|
||||
echo "Secret created..." >&2
|
||||
openssl rand -hex 32 >./secret
|
||||
fi
|
||||
|
||||
# create network
|
||||
if ! podman network inspect container-bridge >/dev/null 2>&1; then
|
||||
echo "Creating container-bridge network..."
|
||||
podman network create container-bridge
|
||||
else
|
||||
echo "container-bridge network already exists"
|
||||
fi
|
||||
|
||||
# Get podman start scripts
|
||||
shopt -s nullglob
|
||||
# start_files=( *-start-*.sh )
|
||||
containers=()
|
||||
|
||||
# Run every start stcript
|
||||
for f in *-start-*.sh; do
|
||||
trim="${f%.sh}"
|
||||
container="${trim#*start-}"
|
||||
containers+=("$container")
|
||||
echo "Running $container"
|
||||
chmod +x "$f"
|
||||
./"$f"
|
||||
done
|
||||
|
||||
# Generate systemd Units
|
||||
|
||||
# mkdir -p ~/.config/systemd/user
|
||||
# for f in "${containers[@]}"; do
|
||||
# echo "Generating systemd Unit for $f"
|
||||
# podman generate systemd --files --name $f
|
||||
# if ! [ -e "patch-${f}-service.sh" ]; then
|
||||
# echo "No patch for container-${f}.service"
|
||||
# else
|
||||
# echo "Patching container-${f}.service..."
|
||||
#
|
||||
# fi
|
||||
# mv container-$f.service ~/.config/systemd/user/
|
||||
# done
|
||||
|
||||
# TODO
|
||||
# Add to container-owncloud_server.service
|
||||
# Requires=container-owncloud_mariadb.service
|
||||
# Requires=container-owncloud_redis.service
|
||||
# After=container-owncloud_mariadb.service
|
||||
# After=container-owncloud_redis.service
|
||||
|
||||
# Add to container-proxy_server.service
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
Reference in New Issue
Block a user