aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO31
-rw-r--r--.gitignore8
-rw-r--r--PKGBUILD71
-rw-r--r--README16
-rw-r--r--megasync-headless.install10
-rw-r--r--megasync.conf12
-rw-r--r--megasyncd.service16
7 files changed, 164 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..0cf449410448
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,31 @@
+pkgbase = megasync-headless
+ pkgdesc = Sync local directory with your MEGA account. CLI tools only. Subset of the original MEGA SDK.
+ pkgver = v2.8.0.0.g2c9286c
+ pkgrel = 1
+ url = https://mega.co.nz/#sync
+ install = megasync-headless.install
+ arch = x86_64
+ license = custom:MEGA
+ makedepends = git
+ depends = c-ares
+ depends = curl
+ depends = crypto++
+ depends = zlib
+ depends = sqlite
+ depends = openssl
+ provides = megasync
+ conflicts = megasync
+ conflicts = megasync-git
+ conflicts = megatools
+ options = !buildflags
+ backup = usr/lib/systemd/system/megasyncd.service
+ backup = etc/conf.d/megasync.conf
+ source = git+https://github.com/meganz/sdk.git#tag=v2.8.0
+ source = megasyncd.service
+ source = megasync.conf
+ sha1sums = SKIP
+ sha1sums = SKIP
+ sha1sums = SKIP
+
+pkgname = megasync-headless
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..775b27576d52
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+*
+!.gitignore
+!PKGBUILD
+!README
+!megasyncd.service
+!megasync.conf
+!megasync-headless.install
+!.SRCINFO
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..f246e3d315c5
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,71 @@
+# Maintainer: Archimede Pitagorico <archimede.pitagorico@mail.com>
+
+pkgname=megasync-headless
+pkgver=v2.8.0.0.g2c9286c
+pkgrel=1
+pkgdesc="Sync local directory with your MEGA account. CLI tools only. Subset of the original MEGA SDK."
+arch=('x86_64')
+url='https://mega.co.nz/#sync'
+license=('custom:MEGA')
+source=('git+https://github.com/meganz/sdk.git#tag=v2.8.0'
+ 'megasyncd.service'
+ 'megasync.conf'
+ )
+install=$pkgname.install
+backup=('usr/lib/systemd/system/megasyncd.service'
+ 'etc/conf.d/megasync.conf'
+ )
+conflicts=('megasync'
+ 'megasync-git'
+ 'megatools'
+ )
+provides=('megasync')
+depends=('c-ares'
+ 'curl'
+ 'crypto++'
+ 'zlib'
+ 'sqlite'
+ 'openssl'
+ )
+makedepends=('git'
+ )
+sha1sums=('SKIP'
+ 'SKIP'
+ 'SKIP'
+ )
+options=('!buildflags'
+ )
+
+pkgver() {
+ cd sdk
+ echo "$(git describe --long --tags | tr - . | tr _ .)"
+}
+
+prepare() {
+ cd sdk
+ ./autogen.sh
+
+ ./configure \
+ --without-freeimage \
+ --without-sodium
+}
+
+build() {
+ cd sdk
+ make examples/megacli
+ make examples/megasimplesync
+}
+
+package() {
+ install -Dm644 megasyncd.service "${pkgdir}/usr/lib/systemd/system/megasyncd.service"
+ install -Dm600 megasync.conf "${pkgdir}/etc/conf.d/megasync.conf"
+
+ cd sdk
+ make DESTDIR=${pkgdir} install
+ # we do not need the include files
+ rm -rf ${pkgdir}/usr/local/include
+ install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ mkdir -p "${pkgdir}/srv/mega"
+ mkdir -p "${pkgdir}/var/mega"
+ chmod 0700 "${pkgdir}/var/mega"
+}
diff --git a/README b/README
new file mode 100644
index 000000000000..5f8d1c8b0452
--- /dev/null
+++ b/README
@@ -0,0 +1,16 @@
+Some notes about this package:
+
+The package creates and install 3 executables:
+*) megacli - advanced console MEGA client, to get information about available commands please start the
+application in the Terminal and type â"h" to get commands description.
+*) megasimplesync - a simple synchronization client, it gets username / password values from corresponding
+environment variables.
+*) megafuse: to mount a remote mega directory
+
+These executables are part of the MEGA SDK and are provided as examples
+They are considered by MEGA experimental software and are not supported.
+
+The package compiles only a subset of the original MEGA SDK, the mimimun necessary for these 3 files to work.
+
+The package contains no code of mine, except for the PKGBUILD and the mega.service file.
+
diff --git a/megasync-headless.install b/megasync-headless.install
new file mode 100644
index 000000000000..b38abe84ff57
--- /dev/null
+++ b/megasync-headless.install
@@ -0,0 +1,10 @@
+# This is a default template for a post-install scriptlet.
+# Uncomment only required functions and remove any functions
+# you don't need (and this header).
+
+# arg 1: the new package version
+post_install() {
+usr/bin/echo "******************************************************************"
+usr/bin/echo " SET YOUR CREDENTIALS IN /etc/conf.d/megasync-headless.conf"
+usr/bin/echo "******************************************************************"
+}
diff --git a/megasync.conf b/megasync.conf
new file mode 100644
index 000000000000..913d56b26213
--- /dev/null
+++ b/megasync.conf
@@ -0,0 +1,12 @@
+# The directory where MEGA temporary DB files will be created
+MEGA_WORK_DIR="/var/mega"
+
+# The local directory to keep in sync with the MEGA server
+MEGA_LOCAL_DIR="/srv/mega"
+
+# The remote directory on the MEGA server
+MEGA_REMOTE_DIR="/"
+
+# Your MEGA credentials
+MEGA_EMAIL=""
+MEGA_PWD=""
diff --git a/megasyncd.service b/megasyncd.service
new file mode 100644
index 000000000000..30776cc9faa2
--- /dev/null
+++ b/megasyncd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Mega sync client
+After=local-fs.target network.target
+
+[Service]
+Type=simple
+EnvironmentFile=/etc/conf.d/megasync.conf
+ExecStart=/usr/bin/bash -c "cd $MEGA_WORK_DIR && /usr/local/bin/megasimplesync $MEGA_LOCAL_DIR $MEGA_REMOTE_DIR"
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+Restart=on-failure
+RestartSec=30s
+
+[Install]
+WantedBy=multi-user.target
+