aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Hudson2021-12-27 23:55:27 +0000
committerGeoff Hudson2021-12-27 23:55:27 +0000
commit66c244bbd6f11b72c7d04ce26c9e1829763cfed3 (patch)
treeb8d732d8dac7359cfb8eaf555589c9d592581967
parentaf8941bf28d52e2ea978e786f0607461114fcbf8 (diff)
downloadaur-66c244bbd6f11b72c7d04ce26c9e1829763cfed3.tar.gz
Update to include update.sh, to detect auto updates
-rw-r--r--.SRCINFO13
-rw-r--r--PKGBUILD53
-rw-r--r--crashplan-pro78
-rw-r--r--crashplan-pro.install11
-rw-r--r--crashplan-pro.service7
-rw-r--r--crashplan-pro_upgrade.path9
-rw-r--r--crashplan-pro_upgrade.service11
-rwxr-xr-xupgrade.sh62
8 files changed, 123 insertions, 121 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 27dd927cd80b..ec3d13d37a10 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,9 +1,8 @@
pkgbase = crashplan-pro
pkgdesc = An business online/offsite backup solution
pkgver = 8.8.1
- pkgrel = 1
+ pkgrel = 2
url = http://www.crashplan.com/business
- install = crashplan-pro.install
arch = x86_64
license = custom
makedepends = cpio
@@ -16,10 +15,14 @@ pkgbase = crashplan-pro
conflicts = crashplan
options = !strip
source = https://download.code42.com/installs/agent/cloud/8.8.1/36/install/CrashPlanSmb_8.8.1_1525200006881_36_Linux.tgz
- source = crashplan-pro
source = crashplan-pro.service
+ source = upgrade.sh
+ source = crashplan-pro_upgrade.service
+ source = crashplan-pro_upgrade.path
sha1sums = 8afc06a75f35be5b6eec68abddd32fb8c8a80871
- sha1sums = c6bf34f1b0ba0bd8d9eb04f6b300112e3c053f84
- sha1sums = ad5a293e832dec5e7f6ef6ba02d4a8a5a1da8941
+ sha1sums = 068c73e030c4ae12b97960d90d736ad42d41f9de
+ sha1sums = 3b7a17085cf93170254fb9f29bfc5a683f29f2de
+ sha1sums = a6c1f459caefbc581cfe5638cc9cb95894547f17
+ sha1sums = 844c4fd73692d888f8dd27b145652a9f571d7133
pkgname = crashplan-pro
diff --git a/PKGBUILD b/PKGBUILD
index bcaf624be207..8cfd790424df 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,7 +5,7 @@ _pkgname=crashplan
pkgver=8.8.1
_pkgtimestamp=1525200006881
_pkgbuild=36
-pkgrel=1
+pkgrel=2
pkgdesc="An business online/offsite backup solution"
url="http://www.crashplan.com/business"
arch=('x86_64')
@@ -14,13 +14,17 @@ depends=('bash' 'java-runtime-headless=8' 'alsa-lib' 'gtk3' 'libxss' 'inetutils'
# We are trying without gconf or gtk3
makedepends=('cpio')
conflicts=('crashplan')
-install=crashplan-pro.install
+# install=crashplan-pro.install
source=(https://download.code42.com/installs/agent/cloud/${pkgver}/${_pkgbuild}/install/CrashPlanSmb_${pkgver}_${_pkgtimestamp}_${_pkgbuild}_Linux.tgz
- crashplan-pro
- crashplan-pro.service)
+ crashplan-pro.service
+ upgrade.sh
+ crashplan-pro_upgrade.service
+ crashplan-pro_upgrade.path)
sha1sums=('8afc06a75f35be5b6eec68abddd32fb8c8a80871'
- 'c6bf34f1b0ba0bd8d9eb04f6b300112e3c053f84'
- 'ad5a293e832dec5e7f6ef6ba02d4a8a5a1da8941')
+ '068c73e030c4ae12b97960d90d736ad42d41f9de'
+ '3b7a17085cf93170254fb9f29bfc5a683f29f2de'
+ 'a6c1f459caefbc581cfe5638cc9cb95894547f17'
+ '844c4fd73692d888f8dd27b145652a9f571d7133')
options=(!strip)
build() {
cd $srcdir/code42-install
@@ -31,16 +35,19 @@ build() {
echo " - https://support.code42.com/Terms_and_conditions/Legal_terms_and_conditions/CrashPlan_for_Small_Business_EULA"
echo ""
- echo "" > install.vars
- echo "APP_BASENAME=CrashPlan" >> install.vars
- echo "TARGETDIR=/opt/$_pkgname" >> install.vars
- echo "PARENT_DIR=/opt/$_pkgname" >> install.vars
- echo "BINSDIR=" >> install.vars
- echo "MANIFESTDIR=/opt/$_pkgname/manifest" >> install.vars
- echo "INITDIR=" >> install.vars
- echo "RUNLVLDIR=" >> install.vars
- NOW=`date +%Y%m%d`
- echo "INSTALLDATE=$NOW" >> install.vars
+
+
+ cat <<EOF > install.vars
+TARGETDIR=/opt/$_pkgname
+BINSDIR=/opt/$_pkgname/bin
+MANIFESTDIR=/opt/$_pkgname/manifest
+INITDIR=/etc/init.d
+INSTALLDATE=`date +%Y%m%d`
+JAVACOMMON=/opt/$_pkgname/jre/bin/java
+APP_BASENAME=Code42
+DIR_BASENAME=$_pkgname
+APP_DATA_BASE_NAME_LOWER=crashplan
+EOF
sed -i '/^resolve_native_libraries/ s/./#&/' install.sh
sed -i '/^install_service_script/ s/./#&/' install.sh
@@ -67,17 +74,13 @@ package() {
# Fix for encoding troubles (CrashPlan ticket 178827)
# Make sure the daemon is running using the same localization as
# the (installing) user
- echo "" > $srcdir/code42-install/scripts/run.conf
- echo "LC_ALL=$LANG" >> $srcdir/code42-install/scripts/run.conf
-
- # Prevent crashplan from restarting itself repeatedly..
- echo '#!/bin/sh' > bin/restartLinux.sh
- echo 'exit' >> bin/restartLinux.sh
+ echo "LC_ALL=$LANG" > $srcdir/code42-install/scripts/run.conf
install -D -m 644 $srcdir/code42-install/install.vars install.vars
install -D -m 644 $srcdir/code42-install/scripts/run.conf bin/run.conf
install -D -m 755 $srcdir/code42-install/scripts/code42.desktop $pkgdir/usr/share/applications/crashplan.desktop
install -D -m 755 $srcdir/code42-install/scripts/service.sh bin/service.sh
+ install -D -m 755 $srcdir/upgrade.sh bin/upgrade.sh
# We need to change the name for now
ln -sf "/opt/$_pkgname/bin/Code42Service" $pkgdir/opt/crashplan/bin/CrashPlanService
@@ -86,6 +89,12 @@ package() {
# systemd unit
install -D -m 644 $srcdir/crashplan-pro.service $pkgdir/usr/lib/systemd/system/crashplan-pro.service
+ install -D -m 644 $srcdir/crashplan-pro_upgrade.service $pkgdir/usr/lib/systemd/system/crashplan-pro_upgrade.service
+ install -D -m 644 $srcdir/crashplan-pro_upgrade.path $pkgdir/usr/lib/systemd/system/crashplan-pro_upgrade.path
+}
+
+pre_upgrade() {
+ rm -rf /opt/crashplan/upgrade/*
}
post_install() {
diff --git a/crashplan-pro b/crashplan-pro
deleted file mode 100644
index 4ff51355bc6d..000000000000
--- a/crashplan-pro
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-if [[ -f /etc/profile.d/jre.sh ]]; then
- . /etc/profile.d/jre.sh
-elif [[ -f /etc/profile.d/openjdk6.sh ]]; then
- . /etc/profile.d/openjdk6.sh
-fi
-
-WD=/opt/crashplan-pro
-CRASHPLAN=$WD/bin/CrashPlanEngine
-VARS=$WD/install.vars
-CONFIG=$WD/bin/run.conf
-
-test -f $VARS || exit 0
-test -f $CONFIG || exit 0
-test -f $CRASHPLAN || exit 0
-
-. $VARS
-. $CONFIG
-
-
-
-if [[ ${LC_ALL} ]]; then
- LOCALE=`sed 's/\..*//g' <<< ${LC_ALL}`
- export LC_ALL="${LOCALE}.UTF-8"
-elif [[ ${LC_CTYPE} ]]; then
- LOCALE=`sed 's/\..*//g' <<< ${LC_CTYPE}`
- export LC_CTYPE="${LOCALE}.UTF-8"
-elif [[ ${LANG} ]]; then
- LOCALE=`sed 's/\..*//g' <<< ${LANG}`
- export LANG="${LOCALE}.UTF-8"
-else
- export LANG="en_US.UTF-8"
-fi
-
-[[ `$CRASHPLAN status` != "CrashPlan Engine is stopped." ]] && PID=`$CRASHPLAN status | sed -r 's/CrashPlan Engine \(pid ([0-9]+)\).*/\1/'`
-
-case "$1" in
- start)
- stat_busy "Starting CrashPlan Engine"
- PWD=`pwd`
- cd $WD
- [[ -z "$PID" ]] && nice -n 19 $CRASHPLAN start > /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon crashplan
- stat_done
- fi
- cd $PWD
- ;;
- stop)
- stat_busy "Stopping CrashPlan Engine"
- [[ ! -z "&PID" ]] && $CRASHPLAN stop &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon crashplan
- stat_done
- fi
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- status)
- $CRASHPLAN status
- ;;
- *)
- echo "Usage: $0 <start|stop|restart|status>" >&2
- exit 3
- ;;
-esac
-
diff --git a/crashplan-pro.install b/crashplan-pro.install
deleted file mode 100644
index cd6480a50df1..000000000000
--- a/crashplan-pro.install
+++ /dev/null
@@ -1,11 +0,0 @@
-post_install () {
- INOTIFY_WATCHES=`cat /proc/sys/fs/inotify/max_user_watches`
- if [[ $INOTIFY_WATCHES -le 8192 ]]; then
- echo ""
- echo "Your system is currently configured to watch $INOTIFY_WATCHES files in real time."
- echo "CrashPlan recommends using a larger value; see the CrashPlan support site for details."
- echo "e.g. add the following line to /etc/sysctl.d/99-sysctl.conf "
- echo " fs.inotify.max_user_watches=1048576"
- echo ""
- fi
-}
diff --git a/crashplan-pro.service b/crashplan-pro.service
index 8bd946e2f8ae..a344be20d5c4 100644
--- a/crashplan-pro.service
+++ b/crashplan-pro.service
@@ -8,11 +8,8 @@ Type=forking
PIDFile=/opt/crashplan/Code42Service.pid
EnvironmentFile=/opt/crashplan/bin/run.conf
WorkingDirectory=/opt/crashplan
-ExecStartPre=/usr/bin/chattr -i /opt/crashplan/conf/tmp
-ExecStart=/opt/crashplan/bin/CrashPlanEngine start
-ExecStartPost=/usr/bin/chattr +i /opt/crashplan/upgrade
-ExecStartPost=/usr/bin/chattr +i /opt/crashplan/conf/tmp
-ExecStop=/opt/crashplan/bin/CrashPlanEngine stop
+ExecStart=/opt/crashplan/bin/service.sh start
+ExecStop=/opt/crashplan/bin/service.sh stop
Restart=always
[Install]
diff --git a/crashplan-pro_upgrade.path b/crashplan-pro_upgrade.path
new file mode 100644
index 000000000000..611a56120d63
--- /dev/null
+++ b/crashplan-pro_upgrade.path
@@ -0,0 +1,9 @@
+[Unit]
+Description="File monitor for updates from the Crashplan Daemon"
+
+[Path]
+DirectoryNotEmpty=/opt/crashplan/upgrade
+Unit=crashplan-pro_upgrade.service
+
+[Install]
+WantedBy=multi-user.target
diff --git a/crashplan-pro_upgrade.service b/crashplan-pro_upgrade.service
new file mode 100644
index 000000000000..99205459fd94
--- /dev/null
+++ b/crashplan-pro_upgrade.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=CrashPlanPRO Backup Engine Upgrade
+After=network.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=/opt/crashplan/bin/run.conf
+WorkingDirectory=/opt/crashplan
+ExecStart=/opt/crashplan/bin/upgrade.sh
+Restart=no
+
diff --git a/upgrade.sh b/upgrade.sh
new file mode 100755
index 000000000000..c9cf44957839
--- /dev/null
+++ b/upgrade.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+set -e
+
+TMP=$(mktemp -d)
+UPDATE_PATH=$(find /opt/crashplan/upgrade/ -mindepth 1 -maxdepth 1 -type d -print)
+
+if [[ -z ${UPDATE_PATH} ]]; then
+ echo "False Trigger of update script"
+ exit 1
+fi
+
+if [[ -z $USER ]]; then
+ USER=root
+fi
+
+cp /opt/crashplan/bin/upgrade.sh ${TMP}/upgrade.sh
+
+echo "Editing ${UPDATE_PATH}/install.sh"
+
+# This used to be set to an odd locale otherwise
+echo "LC_ALL=$LANG" > ${UPDATE_PATH}/run.conf
+
+# First correct the defaults to match our system
+/usr/bin/sed -i 's/^PARENT_DIR=$/PARENT_DIR=\/opt/g' ${UPDATE_PATH}/install.sh
+# /usr/bin/sed -i 's/^APP_DIR=$/APP_DIR=\/opt\/crashplan/g' ${UPDATE_PATH}/install.sh
+/usr/bin/sed -i 's/^APP_DIR=$/APP_DIR=\/opt/g' ${UPDATE_PATH}/install.sh
+/usr/bin/sed -i 's/^BIN_DIR=$/BIN_DIR=\/opt\/crashplan\/bin/g' ${UPDATE_PATH}/install.sh
+
+/usr/bin/sed -i 's/^MANIFEST_DIR=$/MANIFEST_DIR=\/opt\/crashplan\/manifest/g' ${UPDATE_PATH}/install.sh
+/usr/bin/sed -i 's/^APP_BASENAME=.*$/APP_BASENAME="CrashPlan"/g' ${UPDATE_PATH}/install.sh
+
+/usr/bin/sed -i '/^resolve_native_libraries/ s/./#&/' ${UPDATE_PATH}/install.sh
+/usr/bin/sed -i '/^install_service_script/ s/./#&/' ${UPDATE_PATH}/install.sh
+/usr/bin/sed -i '/^install_launcher/ s/./#&/' ${UPDATE_PATH}/install.sh
+/usr/bin/sed -i '/^start_service/ s/./#&/' ${UPDATE_PATH}/install.sh
+/usr/bin/sed -i '/^prompt_to_start_desktop/ s/./#&/' ${UPDATE_PATH}/install.sh
+
+# And the uninstall section
+/usr/bin/sed -i '/^[[:blank:]]*verify_target_user_dir/ s/./:#&/' ${UPDATE_PATH}/uninstall.sh
+/usr/bin/sed -i '/^[[:blank:]]*remove_desktop_launchers/ s/./#&/' ${UPDATE_PATH}/uninstall.sh
+/usr/bin/sed -i '/^[[:blank:]]*remove_electron_configs/ s/./#&/' ${UPDATE_PATH}/uninstall.sh
+/usr/bin/sed -i '/^[[:blank:]]*strip_keys_from_indentity_file/ s/./#&/' ${UPDATE_PATH}/uninstall.sh
+
+echo "Installing update"
+cd ${UPDATE_PATH} && ${UPDATE_PATH}/install.sh -q -v -u $USER
+
+cp ${TMP}/upgrade.sh /opt/crashplan/bin/upgrade.sh
+
+echo "Amending installed files"
+install -D -m 755 ${UPDATE_PATH}/scripts/desktop.sh /opt/crashplan/bin/desktop.sh
+install -D -m 755 ${UPDATE_PATH}/scripts/service.sh /opt/crashplan/bin/service.sh
+
+echo "LC_ALL=$LANG" > /opt/crashplan/bin/run.conf
+
+# Rebuild the additional steps
+ln -sf "/opt/crachplan/bin/Code42Service" /opt/crashplan/bin/CrashPlanService
+ln -sf "/opt/crachplan/bin/desktop.sh" /opt/crashplan/bin/CrashPlanDesktop
+ln -sf "/opt/crachplan/bin/service.sh" /opt/crashplan/bin/CrashPlanEngine
+
+rm -rf ${TMP}
+rm -rf /opt/crashplan/upgrade/*
+echo "Done!"