diff --git a/Dockerfile b/Dockerfile index 6d852a2..c31e6f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # NAME leenooks/mysticbbs -# VERSION 1.12a39 +# VERSION 1.12a42 FROM debian:stretch-slim @@ -8,7 +8,7 @@ MAINTAINER Deon George # Pre-requisites # + Base application requires unzip zip curl libhunspell-dev libpython2.7 RUN apt-get update \ - && apt-get install -yqq unzip zip curl libhunspell-dev libpython2.7 \ + && apt-get install -yqq unzip zip curl libhunspell-dev libpython2.7 patch \ && rm -rf /var/lib/apt/lists/* /tmp/* # Add in Leenooks' apt repository @@ -16,7 +16,7 @@ RUN curl -s http://apt.leenooks.net/setup.sh | sh # For SSH connections RUN apt-get update \ - && apt-get install --allow-unauthenticated -yqq cryptlib \ + && apt-get install --allow-unauthenticated -yqq libcl \ && rm -rf /var/lib/apt/lists/* /tmp/* RUN ln -sf /usr/share/zoneinfo/Australia/Melbourne /etc/localtime @@ -25,12 +25,12 @@ WORKDIR /mystic ENV mysticbbs /mystic/data EXPOSE 22 23 24554 -COPY init /sbin/init -ENTRYPOINT [ "/sbin/init" ] -CMD [ "start" ] - ADD mystic.tar.gz / VOLUME ["/mystic/data"] # Enable custom scripts to live in the data dir RUN ln -sf ../data/scripts /mystic/scripts/custom + +COPY init /sbin/init +ENTRYPOINT [ "/sbin/init" ] +CMD [ "start" ] diff --git a/cleaninstall/cleaninstall.sh b/cleaninstall/cleaninstall.sh index 989aff7..9e63b4e 100755 --- a/cleaninstall/cleaninstall.sh +++ b/cleaninstall/cleaninstall.sh @@ -2,7 +2,7 @@ set -e -MYSTIC_SOURCE=${1:-mys112a39_pi.zip} +MYSTIC_SOURCE=${1:-mys112a42_pi.zip} [ "$1" ] && shift SPELL_SOURCE=${1:-mystic_spellcheck_v2.zip} [ "$1" ] && shift @@ -25,6 +25,7 @@ else [ -d ${CLEAN_INSTALL_DIR} ] && echo "ERROR: Directory [${CLEAN_INSTALL_DIR}] already exists!" && exit 1 unzip ${MYSTIC_SOURCE} -d ${CLEAN_INSTALL_DIR} + chmod +x ${CLEAN_INSTALL_DIR}/install [ $? -gt 0 ] && echo "ERROR: Unzip failed?" && exit 1 # 3) Run docker with -v mapping the unzip files to an arbitrary directory -v unzipfiles:/install diff --git a/init b/init index 64fd096..88282fd 100755 --- a/init +++ b/init @@ -2,6 +2,7 @@ set -e NAME="Mystic BBS" +VERSION="A42" INIT=mis function stop { @@ -14,7 +15,50 @@ export PATH=$PATH:/mystic if [ "$1" == "start" ]; then # First time install - expand out our data directory - [ $(find data|wc -l) -le 1 ] && tar xzf data.tar.gz && echo "* Installing Mystic data files into /mystic/data" + if [ $(find data|wc -l) -le 1 ]; then + echo "** First time install, deploying sample setup" + tar xzf data.tar.gz + echo ${VERSION} > .version + + # We need to upgrade + else + OLD_VERSION=$(cat data/.version) + echo "** Upgrading [${OLD_VERSION}]" + case ${OLD_VERSION} in + A39) + echo "Processing data/default.txt" + set -x + [ ! -d data/upgrade/${VERSION}/${OLD_VERSION} ] && mkdir -p data/upgrade/${VERSION}/${OLD_VERSION} + cd data/upgrade/${VERSION}/${OLD_VERSION} + [ -d data ] && rm -rf data + tar xzf /mystic/data.tar.gz + cd /mystic/data + diff -u data/default.txt upgrade/${VERSION}/${OLD_VERSION}/data/data/default.txt > upgrade/${VERSION}/${OLD_VERSION}/default.txt.patch && echo $? + if [ -s upgrade/${VERSION}/${OLD_VERSION}/default.txt.patch ]; then + patch -p 0 < upgrade/${VERSION}/${OLD_VERSION}/default.txt.patch + echo "! Check upgrade/${VERSION}/${OLD_VERSION}/default.txt.patch for an strings that may have been overwritten..." + else + rm -f upgrade/${VERSION}/${OLD_VERSION}/default.txt.patch + fi + + for i in msg_index.ini msg_index.ans msg_index_help.ans; do + cp upgrade/${VERSION}/${OLD_VERSION}/data/text/$i text/ + done + + cp upgrade/${VERSION}/${OLD_VERSION}/data/data/cfgroot4.ans data/ + ../upgrade + cd ../scripts + ./mplc -all + cd ../data + rm -rf upgrade/${VERSION}/${OLD_VERSION}/data + echo A42 > .version + ;; + + A42) echo "Already up to date!" ;; + + *) echo "!! Dont know how to upgrade" && exit 1 + esac + fi # OK, start exec ${INIT} server diff --git a/mystic.tar.gz b/mystic.tar.gz index 80a3c15..c2885fb 100644 Binary files a/mystic.tar.gz and b/mystic.tar.gz differ