aboutsummaryrefslogtreecommitdiff
path: root/owncloud-dl
blob: 3ac5a605354a3b6a352fd2e368c8c7fb15a8eb09 (plain)
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
#!/bin/bash
#
# Owncloud software upgrader.
# See http://doc.owncloud.org/server/7.0/admin_manual/maintenance/upgrade.html
#

# Config parameters
BASENAME="`basename $0`"
OLD_VERSION="$1"
VERSION="$2"

# Syntax check
if [ -z "$2" ]; then
  echo "usage: $BASENAME <old-version> <new-version>"
  exit 1
fi

# Check installed versions
if [ ! -d "owncloud-$OLD_VERSION" ]; then
  echo "error: owncloud-$OLD_VERSION is not installed, aborting."
  exit 1
elif [ -d "owncloud-$VERSION" ]; then
  echo "error: owncloud-$VERSION already installed, aborting."
  exit 1
fi

# Download package
wget https://download.owncloud.org/community/owncloud-$VERSION.tar.bz2

# Decompress
(
  mkdir tmp
  cd tmp
  tar xvf ../owncloud-$VERSION.tar.bz2
  mv owncloud ../owncloud-$VERSION
  cd ..
  rmdir tmp
)

# Remove package
rm owncloud-$VERSION.tar.bz2

# Sync configuration
chown -R root. owncloud-$VERSION
rsync -av owncloud-$OLD_VERSION/config/ owncloud-$VERSION/config/

# Symlink to contrib content
(
  cd owncloud-$VERSION
  ln -s ../contrib
  rm -rf themes
  ln -s contrib/themes
)

# Pivot
rm owncloud && ln -s owncloud-$VERSION owncloud

# Audit
echo "Audit:" && \
du -hs owncloud-$OLD_VERSION && \
du -hs owncloud-$VERSION

# Finish
echo "Please fix config.php manually."