X-Git-Url: https://code.citadel.org/?p=citadel-docker.git;a=blobdiff_plain;f=run-citadel.sh;fp=run-citadel.sh;h=a763998e9862f83a88494d17e862f17e966cfcb5;hp=6ff9a03a203f9f8ee137ca7d8e23f63b9239a86e;hb=f8943c6f2597101db46064435ef6a2af09cd0d79;hpb=468759f5d6d26de920f6be16f6776607f99dafe3 diff --git a/run-citadel.sh b/run-citadel.sh index 6ff9a03..a763998 100755 --- a/run-citadel.sh +++ b/run-citadel.sh @@ -5,18 +5,60 @@ # The container expects a persistent volume called "citadel-data" in which it will keep everything. # The remainder of the container is ephermal and can be deleted at any time. -# If you want to keep your Citadel data in a specific directory on the host, -# set CTDL_VOL to "bind" and CTDL_DIR to the full pathname of that directory. -# This is what you want if you are switching from Easy Install to Docker. -# -#CTDL_VOL=bind -#CTDL_DIR=/usr/local/citadel -# If you want to keep your Citadel data in a Docker volume, -# set CTDL_VOL to "volume" and CTDL_DIR to the name of the volume. -# -CTDL_VOL=volume -CTDL_DIR=citadel-data +# Parse the command line arguments + +migrate_mode=false +database_cleanup_mode=false +volume_mode=false +bind_mode=false + +while getopts ":mdv:h:" o +do + case "${o}" in + m) + echo "migrate mode" + migrate_mode=true + ;; + d) + echo "database cleanup mode"; + database_cleanup_mode=true + ;; + v) + volume_mode=true + CTDL_DIR=${OPTARG} + ;; + h) + bind_mode=true + CTDL_DIR=${OPTARG} + ;; + *) + echo "$0: usage: $0 [-v volume_name] [-h home_directory] [-m] [-v] container_image_name [other parameters]" + exit 1 + ;; + esac +done +shift $((OPTIND-1)) + +if ( ${volume_mode} && ${bind_mode} ) ; then + echo "$0: -v and -h cannot both be specified." + exit 2 +fi + +if ${volume_mode} ; then + CTDL_VOL=volume +elif ${bind_mode} ; then + CTDL_VOL=bind +else + volume_mode=true + CTDL_VOL=volume + CTDL_DIR=citadel-data +fi + +if ( ${migrate_mode} && ${database_cleanup_mode} ) ; then + echo "$0: -m and -d cannot both be specified." + exit 3 +fi docker version >/dev/null 2>&1 || { echo Docker engine is not installed on this host.