Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
FerroSoftware committed Sep 17, 2016
1 parent e7b2da5 commit 14707df
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 18 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
@@ -1,7 +1,10 @@
FROM debian:latest
MAINTAINER Ferro Software
RUN dpkg --add-architecture i386
RUN apt-get update && apt-get install -y wine:i386 wget xvfb
RUN apt-get update && apt-get install -y locales wine:i386 wget xvfb
RUN echo "pl_PL.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen pl_PL.utf8 \
&& /usr/sbin/update-locale LANG=pl_PL.UTF-8
ADD start.sh /start.sh
VOLUME ["/fbs"]
EXPOSE 4530 4531
Expand Down
76 changes: 59 additions & 17 deletions start.sh
@@ -1,17 +1,21 @@
#!/bin/bash
trap finalize SIGTERM

function log() {
echo -e "\n#" $(date --iso-8601=seconds) " $1"
}

function finalize() {
echo "Shutting down FBS ($COMPONENTS)..."
log "Shutting down FBS ($COMPONENTS)..."
if [ "$ISSERVER" = true ] ; then
wine $APPPATH/FBSServer.exe -stop
fi
echo "Done."
log "Done."
exit
}

function startX() {
echo "Starting Xvfb..."
log "Starting Xvfb..."
rm -f /tmp/.X0-lock
Xvfb :0 -screen 0 1024x768x16 &
sleep 2
Expand All @@ -24,6 +28,7 @@ function isHttpServerAlive() {
}

function isServerProcessAlive() {
PREVSERVERPROCESSALIVE=$SERVERPROCESSALIVE
pgrep "FBSServer.exe" > /dev/null && SERVERPROCESSALIVE=true || SERVERPROCESSALIVE=false
}

Expand All @@ -34,18 +39,18 @@ function isAutoupdateInProgress() {
function watchdog() {
if [ "$ISSERVER" = true ] ; then
isServerProcessAlive
if [ "$SERVERPROCESSALIVE" = false ] ; then
if [ "$SERVERPROCESSALIVE" = false ] && [ "$PREVSERVERPROCESSALIVE" = true ] ; then
isAutoupdateInProgress
if [ "$AUTOUPDATE" = false ] ; then
echo "FBSServer.exe proccess has been terminated. Restarting FBS Server service..."
log "FBSServer.exe proccess has been terminated. Restarting FBS Server service..."
wine $APPPATH/FBSServer.exe -start
fi
else
isHttpServerAlive
if [ "$HTTPSERVERALIVE" = false ] && [ "$PREVHTTPSERVERALIVE" = true ] ; then
isAutoupdateInProgress
if [ "$AUTOUPDATE" = false ] ; then
echo "HTTP server is not responding. Stopping FBS Server service..."
log "HTTP server is not responding. Stopping FBS Server service..."
wine $APPPATH/FBSServer.exe -stop
fi
fi
Expand All @@ -55,17 +60,41 @@ function watchdog() {
}

function install() {
echo "Installation..."
if [ -d $APPPATH ]; then
UPDATE=true
INSTTEXT="Update"
else
UPDATE=false
INSTTEXT="Installation"
fi


log "$INSTTEXT..."

chmod -R 777 /fbs
if [ ! $? -eq 0 ];then
log "Access denied."
exit 1
fi


echo "Downloading installer..."
log "Downloading installer..."
cd /tmp && wget www.ferrobackup.com/download/Fbs5InstDocker.exe
echo "Initializing Wine..."
wine ipconfig
log "Initializing Wine..."
WINEDEBUG=-all wine ipconfig > /dev/null
startX
echo "Installing FBS ($COMPONENTS)..."
wine /tmp/$INSTFILE /SP- /verysilent /noicons /LOG /COMPONENTS="$COMPONENTS" /dir="Z:$APPPATH"
log "FBS ($COMPONENTS) - $INSTTEXT..."
rm -f -v /tmp/setup.log
wine /tmp/$INSTFILE /SP- /verysilent /noicons /SUPPRESSMSGBOXES /LOG="Z:\tmp\setup.log" /COMPONENTS="$COMPONENTS" /dir="Z:$APPPATH"

INSTOUT=$?
if [ ! $INSTOUT -eq 0 ];then
log "Setup failed to initialize. Error: $INSTOUT"
cat /tmp/setup.log
exit 1
fi

echo "Installation complete"
log "$INSTTEXT completed"
}


Expand All @@ -81,7 +110,11 @@ else
fi


echo "Starting..."
log "################################"
log "##### Ferro Backup System ######"
log "################################"

log "Starting..."


if [ ! -f /tmp/$INSTFILE ]
Expand All @@ -92,15 +125,24 @@ else
fi


echo "Starting NT services ($COMPONENTS)..."
log "Starting NT services ($COMPONENTS)..."


export LC_ALL=pl_PL.UTF-8
export LANG=pl_PL.UTF-8
cp /usr/share/zoneinfo/Europe/Warsaw /etc/localtime

sleep 10
/usr/lib/i386-linux-gnu/wine/bin/wineserver -p
wine ipconfig /all
wine ipconfig > /dev/null

echo
uname -a
lscpu



echo "Press any key to exit..."
log "Press any key to exit..."
while true
do
sleep 1.0;
Expand Down

0 comments on commit 14707df

Please sign in to comment.