diff --git a/.travis.yml b/.travis.yml
index 04f39408a0a3189221a5d2f83b1978a1541a2b7d..ffd1375b1a13bfb16712ae28881921ae9d6fe60a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,8 +10,8 @@ branches:
 
 script:
   - mntdir='/mnt/ocs-url'
-  - docker run --rm -v $(pwd):${mntdir} ubuntu:14.04 /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh ubuntu"
-  - docker run --rm -v $(pwd):${mntdir} fedora:20 /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh fedora"
-  - docker run --rm -v $(pwd):${mntdir} opensuse:42.1 /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh opensuse"
-  - docker run --rm -v $(pwd):${mntdir} base/archlinux:latest /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh archlinux"
+  - docker run --rm -v $(pwd):${mntdir} ubuntu:14.04 /bin/bash -c "sh ${mntdir}/scripts/package.sh ci_ubuntu_deb"
+  - docker run --rm -v $(pwd):${mntdir} fedora:20 /bin/bash -c "sh ${mntdir}/scripts/package.sh ci_fedora_rpm"
+  - docker run --rm -v $(pwd):${mntdir} opensuse:42.1 /bin/bash -c "sh ${mntdir}/scripts/package.sh ci_opensuse_rpm"
+  - docker run --rm -v $(pwd):${mntdir} base/archlinux:latest /bin/bash -c "sh ${mntdir}/scripts/package.sh ci_archlinux_pkg"
   - cat transfer.log
diff --git a/pkg/archlinux/PKGBUILD b/pkg/archlinux/PKGBUILD
index 0a2537f5cd9201f442e52904e5433425b5a7bb61..17e387e6d714093f8b13aab88bdc483f8dda3306 100644
--- a/pkg/archlinux/PKGBUILD
+++ b/pkg/archlinux/PKGBUILD
@@ -22,7 +22,7 @@ prepare() {
 build() {
     #cd "${pkgname}-release-${pkgver}"
     cd "${pkgname}"
-    qmake PREFIX="/usr"
+    qmake PREFIX=/usr
     make
 }
 
diff --git a/pkg/fedora/ocs-url.spec b/pkg/fedora/ocs-url.spec
index a7f1a3ddfde6bd077689c251a9ec0954b748aec4..1dd527af161de08f70b7293d9c263e3e63784b8b 100644
--- a/pkg/fedora/ocs-url.spec
+++ b/pkg/fedora/ocs-url.spec
@@ -10,7 +10,7 @@ URL: https://github.com/opendesktop/ocs-url
 Source0: %{name}.tar.gz
 
 Requires: qt5-qtbase >= 5.2.0, qt5-qtbase-gui >= 5.2.0, qt5-qtsvg >= 5.2.0, qt5-qtdeclarative >= 5.2.0, qt5-qtquickcontrols >= 5.2.0
-BuildRequires: make, automake, gcc, gcc-c++, libtool, qt5-qtbase-devel >= 5.2.0, qt5-qtsvg-devel >= 5.2.0, qt5-qtdeclarative-devel >= 5.2.0, git, rpm-build
+BuildRequires: git, make, automake, gcc, gcc-c++, libtool, qt5-qtbase-devel >= 5.2.0, qt5-qtsvg-devel >= 5.2.0, qt5-qtdeclarative-devel >= 5.2.0, rpm-build
 
 %description
 An install helper program for items served on OpenCollaborationServices (OCS).
@@ -22,7 +22,7 @@ sh scripts/prepare.sh
 
 %build
 %define debug_package %{nil}
-qmake-qt5 PREFIX="/usr"
+qmake-qt5 PREFIX=/usr
 make
 
 %install
diff --git a/pkg/opensuse/ocs-url.spec b/pkg/opensuse/ocs-url.spec
index 32bfcd50807504d74836396158a3e32c57aeaf52..cdb9fa5b60313f9701360d2078675e7b3e1cbdeb 100644
--- a/pkg/opensuse/ocs-url.spec
+++ b/pkg/opensuse/ocs-url.spec
@@ -10,7 +10,7 @@ URL: https://github.com/opendesktop/ocs-url
 Source0: %{name}.tar.gz
 
 Requires: libQt5Svg5 >= 5.2.0, libqt5-qtquickcontrols >= 5.2.0
-BuildRequires: make, automake, gcc, gcc-c++, libtool, libqt5-qtbase-devel >= 5.2.0, libqt5-qtsvg-devel >= 5.2.0, libqt5-qtdeclarative-devel >= 5.2.0, git, rpm-build
+BuildRequires: git, make, automake, gcc, gcc-c++, libtool, libqt5-qtbase-devel >= 5.2.0, libqt5-qtsvg-devel >= 5.2.0, libqt5-qtdeclarative-devel >= 5.2.0, rpm-build
 
 %description
 An install helper program for items served on OpenCollaborationServices (OCS).
@@ -22,7 +22,7 @@ sh scripts/prepare.sh
 
 %build
 %define debug_package %{nil}
-qmake-qt5 PREFIX="/usr"
+qmake-qt5 PREFIX=/usr
 make
 
 %install
diff --git a/pkg/ubuntu/debian/control b/pkg/ubuntu/debian/control
index de4998e9316c160bc054d60aada1852b01764828..52f4b84cf6f166599d37b6e0eacf6de067f5a556 100644
--- a/pkg/ubuntu/debian/control
+++ b/pkg/ubuntu/debian/control
@@ -2,7 +2,7 @@ Source: ocs-url
 Section: web
 Priority: optional
 Maintainer: Akira Ohgaki <akiraohgaki@gmail.com>
-Build-Depends: build-essential, qt5-default (>= 5.2.0), libqt5svg5-dev (>= 5.2.0), qtdeclarative5-dev (>= 5.2.0), git, devscripts, debhelper, fakeroot
+Build-Depends: git, build-essential, qt5-default (>= 5.2.0), libqt5svg5-dev (>= 5.2.0), qtdeclarative5-dev (>= 5.2.0), devscripts, debhelper, fakeroot
 Standards-Version: 3.9.4
 
 Package: ocs-url
diff --git a/pkg/ubuntu/debian/copyright b/pkg/ubuntu/debian/copyright
index e49cfaa43e0095b43f424fa957daa823ef6daedd..a3beebe35b4a2a3f2cefcc46a3b81f794c6513c5 100644
--- a/pkg/ubuntu/debian/copyright
+++ b/pkg/ubuntu/debian/copyright
@@ -4,7 +4,7 @@ Upstream-Contact: Opendesktop.org <contact@opendesktop.org>
 Source: https://github.com/opendesktop/ocs-url
 
 Files: *
-Copyright: 2016-2017, Opendesktop.org
+Copyright: 2016-2018, Opendesktop.org
 License: GPL-3+
  On Debian systems, the full text of the GNU General Public License version 3
  can be found in the `/usr/share/common-licenses/GPL-3' file.
diff --git a/pkg/ubuntu/debian/rules b/pkg/ubuntu/debian/rules
index 1443dc99deb75afd069d3162bd574f42ea82ac2b..25061945abc27574ca10f54fed25872c46f01fcc 100755
--- a/pkg/ubuntu/debian/rules
+++ b/pkg/ubuntu/debian/rules
@@ -5,7 +5,7 @@
 
 override_dh_auto_configure:
 	sh scripts/prepare.sh
-	qmake PREFIX="/usr"
+	qmake PREFIX=/usr
 
 override_dh_auto_install:
 	make INSTALL_ROOT="$(CURDIR)/debian/tmp" install
diff --git a/scripts/build-docker.sh b/scripts/build-docker.sh
deleted file mode 100644
index 7d5c89b12eab0e67465abd016ff91b7ae71e9a5c..0000000000000000000000000000000000000000
--- a/scripts/build-docker.sh
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/bash
-
-PKGNAME='ocs-url'
-
-PKGUSER='pkgbuilder'
-
-BUILDTYPE=''
-if [ "${1}" ]; then
-    BUILDTYPE="${1}"
-fi
-
-PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
-
-BUILDSCRIPT="${PROJDIR}/scripts/build.sh"
-
-TRANSFERLOG="${PROJDIR}/transfer.log"
-
-transfer_file() {
-    filepath="${1}"
-    if [ -f "${filepath}" ]; then
-        filename="$(basename "${filepath}")"
-        echo "Uploading ${filename}" >> "${TRANSFERLOG}"
-        curl -T "${filepath}" "https://transfer.sh/${filename}" >> "${TRANSFERLOG}"
-        echo "" >> "${TRANSFERLOG}"
-    fi
-}
-
-build_ubuntu() {
-    # docker-image: ubuntu:14.04
-    apt update -qq
-    apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
-    apt -y install git devscripts debhelper fakeroot
-    apt -y install curl
-
-    useradd -m ${PKGUSER}
-    export HOME="/home/${PKGUSER}"
-    chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
-
-    su -c "sh "${BUILDSCRIPT}" ${BUILDTYPE}" ${PKGUSER}
-
-    transfer_file "$(find "${PROJDIR}/build_"*${BUILDTYPE} -type f -name "${PKGNAME}*.deb")"
-}
-
-build_fedora() {
-    # docker-image: fedora:20
-    yum -y install make automake gcc gcc-c++ libtool qt5-qtbase-devel qt5-qtsvg-devel qt5-qtdeclarative-devel
-    yum -y install git rpm-build
-    yum -y install curl
-    # docker-image: fedora:22
-    #dnf -y install make automake gcc gcc-c++ libtool qt5-qtbase-devel qt5-qtsvg-devel qt5-qtdeclarative-devel
-    #dnf -y install git rpm-build
-    #dnf -y install curl
-
-    useradd -m ${PKGUSER}
-    export HOME="/home/${PKGUSER}"
-    chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
-
-    su -c "sh "${BUILDSCRIPT}" ${BUILDTYPE}" ${PKGUSER}
-
-    transfer_file "$(find "${PROJDIR}/build_"*${BUILDTYPE} -type f -name "${PKGNAME}*.rpm")"
-}
-
-build_opensuse() {
-    # docker-image: opensuse:42.1
-    zypper --non-interactive refresh
-    zypper --non-interactive install make automake gcc gcc-c++ libtool libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qtdeclarative-devel
-    zypper --non-interactive install git rpm-build
-    zypper --non-interactive install curl
-
-    useradd -m ${PKGUSER}
-    export HOME="/home/${PKGUSER}"
-    chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
-
-    su -c "sh "${BUILDSCRIPT}" ${BUILDTYPE}" ${PKGUSER}
-
-    transfer_file "$(find "${PROJDIR}/build_"*${BUILDTYPE} -type f -name "${PKGNAME}*.rpm")"
-}
-
-build_archlinux() {
-    # docker-image: base/archlinux:latest
-    pacman -Syu --noconfirm
-    pacman -S --noconfirm base-devel qt5-base qt5-svg qt5-declarative qt5-quickcontrols
-    pacman -S --noconfirm git
-    pacman -S --noconfirm curl
-
-    useradd -m ${PKGUSER}
-    export HOME="/home/${PKGUSER}"
-    chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
-
-    su -c "sh "${BUILDSCRIPT}" ${BUILDTYPE}" ${PKGUSER}
-
-    transfer_file "$(find "${PROJDIR}/build_"*${BUILDTYPE} -type f -name "${PKGNAME}*.pkg.tar.xz")"
-}
-
-build_appimage() {
-    echo 'Not implemented yet'
-}
-
-build_snap() {
-    echo 'Not implemented yet'
-}
-
-build_flatpak() {
-    echo 'Not implemented yet'
-}
-
-if [ "${BUILDTYPE}" = 'ubuntu' ]; then
-    build_ubuntu
-elif [ "${BUILDTYPE}" = 'fedora' ]; then
-    build_fedora
-elif [ "${BUILDTYPE}" = 'opensuse' ]; then
-    build_opensuse
-elif [ "${BUILDTYPE}" = 'archlinux' ]; then
-    build_archlinux
-elif [ "${BUILDTYPE}" = 'appimage' ]; then
-    build_appimage
-elif [ "${BUILDTYPE}" = 'snap' ]; then
-    build_snap
-elif [ "${BUILDTYPE}" = 'flatpak' ]; then
-    build_flatpak
-else
-    echo "sh $(basename "${0}") [ubuntu|fedora|archlinux|appimage|snap|flatpak]"
-    exit 1
-fi
diff --git a/scripts/build.sh b/scripts/build.sh
deleted file mode 100644
index 09a56d8cb03d9a560fe01e4ebbe22ef8eeafd2e0..0000000000000000000000000000000000000000
--- a/scripts/build.sh
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/bin/bash
-
-PKGNAME='ocs-url'
-
-BUILDTYPE=''
-if [ "${1}" ]; then
-    BUILDTYPE="${1}"
-fi
-
-PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
-
-BUILDVER="$(cd "${PROJDIR}" && git describe --always)"
-
-BUILDDIR="${PROJDIR}/build_${PKGNAME}_${BUILDVER}_${BUILDTYPE}"
-
-SRCARCHIVE="${BUILDDIR}/${PKGNAME}.tar.gz"
-
-export_srcarchive() {
-    filepath="${1}"
-    $(cd "${PROJDIR}" && git archive --prefix="${PKGNAME}/" --output="${filepath}" HEAD)
-}
-
-build_ubuntu() {
-    cd "${PROJDIR}"
-    mkdir -p "${BUILDDIR}"
-    export_srcarchive "${SRCARCHIVE}"
-
-    tar -xzvf "${SRCARCHIVE}" -C "${BUILDDIR}"
-    cp -r "${PROJDIR}/pkg/ubuntu/debian" "${BUILDDIR}/${PKGNAME}"
-    cd "${BUILDDIR}/${PKGNAME}"
-    debuild -uc -us -b
-}
-
-build_fedora() {
-    cd "${PROJDIR}"
-    mkdir -p "${BUILDDIR}"
-    export_srcarchive "${SRCARCHIVE}"
-
-    mkdir "${BUILDDIR}/SOURCES"
-    mkdir "${BUILDDIR}/SPECS"
-    mv "${SRCARCHIVE}" "${BUILDDIR}/SOURCES"
-    cp "${PROJDIR}/pkg/fedora/${PKGNAME}.spec" "${BUILDDIR}/SPECS"
-    rpmbuild --define "_topdir ${BUILDDIR}" -bb "${BUILDDIR}/SPECS/${PKGNAME}.spec"
-}
-
-build_opensuse() {
-    cd "${PROJDIR}"
-    mkdir -p "${BUILDDIR}"
-    export_srcarchive "${SRCARCHIVE}"
-
-    mkdir "${BUILDDIR}/SOURCES"
-    mkdir "${BUILDDIR}/SPECS"
-    mv "${SRCARCHIVE}" "${BUILDDIR}/SOURCES"
-    cp "${PROJDIR}/pkg/opensuse/${PKGNAME}.spec" "${BUILDDIR}/SPECS"
-    rpmbuild --define "_topdir ${BUILDDIR}" -bb "${BUILDDIR}/SPECS/${PKGNAME}.spec"
-}
-
-build_archlinux() {
-    cd "${PROJDIR}"
-    mkdir -p "${BUILDDIR}"
-    export_srcarchive "${SRCARCHIVE}"
-
-    cp "${PROJDIR}/pkg/archlinux/PKGBUILD" "${BUILDDIR}"
-    cd "${BUILDDIR}"
-    updpkgsums
-    makepkg -s
-}
-
-build_appimage() {
-    echo 'Not implemented yet'
-}
-
-build_snap() {
-    echo 'Not implemented yet'
-}
-
-build_flatpak() {
-    echo 'Not implemented yet'
-}
-
-if [ "${BUILDTYPE}" = 'ubuntu' ]; then
-    build_ubuntu
-elif [ "${BUILDTYPE}" = 'fedora' ]; then
-    build_fedora
-elif [ "${BUILDTYPE}" = 'opensuse' ]; then
-    build_opensuse
-elif [ "${BUILDTYPE}" = 'archlinux' ]; then
-    build_archlinux
-elif [ "${BUILDTYPE}" = 'appimage' ]; then
-    build_appimage
-elif [ "${BUILDTYPE}" = 'snap' ]; then
-    build_snap
-elif [ "${BUILDTYPE}" = 'flatpak' ]; then
-    build_flatpak
-else
-    echo "sh $(basename "${0}") [ubuntu|fedora|archlinux|appimage|snap|flatpak]"
-    exit 1
-fi
diff --git a/scripts/package.sh b/scripts/package.sh
new file mode 100644
index 0000000000000000000000000000000000000000..d4d9244a5b0fa3fe89464a505c940f7a42699b8f
--- /dev/null
+++ b/scripts/package.sh
@@ -0,0 +1,125 @@
+#!/bin/bash
+
+PKGNAME='ocs-url'
+
+USER='pkgbuilder'
+
+SCRIPT="${0}"
+
+PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
+
+BUILDDIR="${PROJDIR}/build_${PKGNAME}"
+
+ci_ubuntu_deb() { # docker-image: ubuntu:14.04
+    apt update -qq
+    apt -y install curl git
+    apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
+    apt -y install devscripts debhelper fakeroot
+
+    useradd -m ${USER}
+    chown -R ${USER} "${PROJDIR}"
+
+    su -c "export HOME=/home/${USER} && sh "${SCRIPT}" build_ubuntu_deb" ${USER}
+
+    transfer_file "$(find "${BUILDDIR}" -type f -name "${PKGNAME}*.deb")"
+}
+
+build_ubuntu_deb() {
+    rm -rf "${BUILDDIR}"
+    mkdir -p "${BUILDDIR}"
+    export_srcarchive "${BUILDDIR}/${PKGNAME}.tar.gz"
+    tar -xzf "${BUILDDIR}/${PKGNAME}.tar.gz" -C "${BUILDDIR}"
+    cp -r "${PROJDIR}/pkg/ubuntu/debian" "${BUILDDIR}/${PKGNAME}"
+    cd "${BUILDDIR}/${PKGNAME}"
+    debuild -uc -us -b
+}
+
+ci_fedora_rpm() { # docker-image: fedora:20
+    yum -y install curl git
+    yum -y install make automake gcc gcc-c++ libtool qt5-qtbase-devel qt5-qtsvg-devel qt5-qtdeclarative-devel
+    yum -y install rpm-build
+
+    useradd -m ${USER}
+    chown -R ${USER} "${PROJDIR}"
+
+    su -c "export HOME=/home/${USER} && sh "${SCRIPT}" build_fedora_rpm" ${USER}
+
+    transfer_file "$(find "${BUILDDIR}" -type f -name "${PKGNAME}*.rpm")"
+}
+
+build_fedora_rpm() {
+    rm -rf "${BUILDDIR}"
+    mkdir -p "${BUILDDIR}"
+    mkdir "${BUILDDIR}/SOURCES"
+    mkdir "${BUILDDIR}/SPECS"
+    export_srcarchive "${BUILDDIR}/SOURCES/${PKGNAME}.tar.gz"
+    cp "${PROJDIR}/pkg/fedora/${PKGNAME}.spec" "${BUILDDIR}/SPECS"
+    rpmbuild --define "_topdir ${BUILDDIR}" -bb "${BUILDDIR}/SPECS/${PKGNAME}.spec"
+}
+
+ci_opensuse_rpm() { # docker-image: opensuse:42.1
+    zypper --non-interactive refresh
+    zypper --non-interactive install curl git
+    zypper --non-interactive install make automake gcc gcc-c++ libtool libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qtdeclarative-devel
+    zypper --non-interactive install rpm-build
+
+    useradd -m ${USER}
+    chown -R ${USER} "${PROJDIR}"
+
+    su -c "export HOME=/home/${USER} && sh "${SCRIPT}" build_opensuse_rpm" ${USER}
+
+    transfer_file "$(find "${BUILDDIR}" -type f -name "${PKGNAME}*.rpm")"
+}
+
+build_opensuse_rpm() {
+    rm -rf "${BUILDDIR}"
+    mkdir -p "${BUILDDIR}"
+    mkdir "${BUILDDIR}/SOURCES"
+    mkdir "${BUILDDIR}/SPECS"
+    export_srcarchive "${BUILDDIR}/SOURCES/${PKGNAME}.tar.gz"
+    cp "${PROJDIR}/pkg/opensuse/${PKGNAME}.spec" "${BUILDDIR}/SPECS"
+    rpmbuild --define "_topdir ${BUILDDIR}" -bb "${BUILDDIR}/SPECS/${PKGNAME}.spec"
+}
+
+ci_archlinux_pkg() { # docker-image: base/archlinux:latest
+    pacman -Syu --noconfirm
+    pacman -S --noconfirm curl git
+    pacman -S --noconfirm base-devel qt5-base qt5-svg qt5-declarative qt5-quickcontrols
+
+    useradd -m ${USER}
+    chown -R ${USER} "${PROJDIR}"
+
+    su -c "export HOME=/home/${USER} && sh "${SCRIPT}" build_archlinux_pkg" ${USER}
+
+    transfer_file "$(find "${BUILDDIR}" -type f -name "${PKGNAME}*.pkg.tar.xz")"
+}
+
+build_archlinux_pkg() {
+    rm -rf "${BUILDDIR}"
+    mkdir -p "${BUILDDIR}"
+    export_srcarchive "${BUILDDIR}/${PKGNAME}.tar.gz"
+    cp "${PROJDIR}/pkg/archlinux/PKGBUILD" "${BUILDDIR}"
+    cd "${BUILDDIR}"
+    updpkgsums
+    makepkg -s
+}
+
+export_srcarchive() {
+    if [ "${1}" ]; then
+        $(cd "${PROJDIR}" && git archive --prefix="${PKGNAME}/" --output="${1}" HEAD)
+    fi
+}
+
+transfer_file() {
+    if [ -f "${1}" ]; then
+        filename="$(basename "${1}")"
+        transferlog="${PROJDIR}/transfer.log"
+        echo "Uploading ${filename}" >> "${transferlog}"
+        curl -fsSL -T "${1}" "https://transfer.sh/${filename}" >> "${transferlog}"
+        echo '' >> "${transferlog}"
+    fi
+}
+
+if [ "${1}" ]; then
+    ${1}
+fi
diff --git a/scripts/scripts.pri b/scripts/scripts.pri
index cffa148bd008ddfffec2f0f05d1057eb8496d54d..de6b1aab073ed7bf170e9b6c989264bf521db687 100644
--- a/scripts/scripts.pri
+++ b/scripts/scripts.pri
@@ -1,4 +1,3 @@
 DISTFILES += \
-    $${PWD}/build-docker.sh \
-    $${PWD}/build.sh \
+    $${PWD}/package.sh \
     $${PWD}/prepare.sh