Ubuntu Pastebin

Paste from ogra at Wed, 2 Sep 2015 13:44:39 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
(RaspberryPi2)ubuntu@localhost:~$ cat /apps/owncloud.canonical/current/bin/owncloud 
#!/bin/bash
#WorkAround for bin-path in root
DOCKER_PATH="/apps/docker/current/bin/"
PATH=$PATH:$DOCKER_PATH
DOCKER_CMD="docker.x86_64"
REPO="kickinz1/owncloud-8.0.2-sqlite3-amd64"

Prepare_Container(){
    mkdir -p ${SNAP_APP_DATA_PATH}/data
    cp -r ${SNAP_APP_PATH}/owncloud ${SNAP_APP_DATA_PATH}
}

#Please change repo according to your needs, be carefull to create
#different container image per supported arch
select_repo () {
  platform=`uname -i` 
  case $platform in
    x86_64)
### This is where you specify your amd64 image
      REPO="kickinz1/owncloud-8.0.2-sqlite3-amd64"
      DOCKER_CMD="docker.x86_64"
      ;;
    armv7l)
### This is where you specify your armhf image
      REPO="kickinz1/owncloud-8.0.2-sqlite3-armhf"
      DOCKER_CMD="docker.armhf"
      ;;
    *)
      echo "unknown platform for snappy-magic: $platform. remember to file a bug or better yet: fix it :)"
      ;;
  esac
  echo ${REPO}
}

select_repo

### Modify the name of your docker container
CONT_NAME="owncloud-8.0.2-snappy"
### You can specify the options for running your docker here:
DOCKER_OPTIONS="-v ${SNAP_APP_DATA_PATH}/owncloud:/var/www/"
DOCKER_OPTIONS="${DOCKER_OPTIONS} -v ${SNAP_APP_DATA_PATH}/data:/var/www/data"
DOCKER_OPTIONS="${DOCKER_OPTIONS} -p 80:80 -p 443:443"
#DOCKER_ENTRYPOINT="--entrypoint=/bin/bash"
#DOCKER_ENTRYPOINT="${DOCKER_ENTRYPOINT}"
DOCKER_ENTRYPOINT=""

#we just stop container if we uninstall owncloud
if [ "$1" == "stop" ]; then
    ${DOCKER_CMD} stop ${CONT_NAME}
    ${DOCKER_CMD} rm -v -f ${CONT_NAME}
    exit
fi

if ! [ -e ${SNAP_APP_DATA_PATH}/owncloud/index.php ]
then
    Prepare_Container
fi

#Just wait two seconds
sleep 2.0

${DOCKER_CMD} rm -v -f ${CONT_NAME}
${DOCKER_CMD} run --name ${CONT_NAME} ${DOCKER_OPTIONS} ${DOCKER_ENTRYPOINT} ${REPO} ${DOCKER_COMMAND}
${DOCKER_CMD} wait ${CONT_NAME}
Download as text