[arch-commits] Commit in emby-server/trunk (5 files)

Maxime Gauduin alucryd at archlinux.org
Thu Sep 17 14:56:31 UTC 2015


    Date: Thursday, September 17, 2015 @ 16:56:31
  Author: alucryd
Revision: 140405

upgpkg: emby-server 3.0.5724.4-2

Fix the package arch
Add a script to migrate the database

Added:
  emby-server/trunk/emby-migrate-database
Modified:
  emby-server/trunk/PKGBUILD
  emby-server/trunk/emby-server
  emby-server/trunk/emby-server.conf
  emby-server/trunk/emby-server.install

-----------------------+
 PKGBUILD              |   11 ++++++---
 emby-migrate-database |   56 ++++++++++++++++++++++++++++++++++++++++++++++++
 emby-server           |    4 +--
 emby-server.conf      |    5 +++-
 emby-server.install   |   26 +++++++++++++++++++---
 5 files changed, 92 insertions(+), 10 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2015-09-17 14:39:13 UTC (rev 140404)
+++ PKGBUILD	2015-09-17 14:56:31 UTC (rev 140405)
@@ -4,9 +4,9 @@
 
 pkgname=emby-server
 pkgver=3.0.5724.4
-pkgrel=1
+pkgrel=2
 pkgdesc='Bring together your videos, music, photos, and live television'
-arch=('i686' 'x86_64')
+arch=('any')
 url='http://emby.media'
 license=('GPL2')
 depends=('ffmpeg' 'imagemagick' 'libmediainfo' 'mono' 'sqlite')
@@ -13,12 +13,14 @@
 install='emby-server.install'
 source=("emby-server-${pkgver}.tar.gz::https://github.com/MediaBrowser/MediaBrowser/archive/${pkgver}.tar.gz"
         'emby-server'
+        'emby-migrate-database'
         'emby-server.conf'
         'emby-server.service')
 backup=('etc/conf.d/emby-server')
 sha256sums=('79d0b17ca5022ad3283c1034f5a8c3bd68dedc97f2cb9507d553f5e91b1cc53e'
-            '1515d8d61ba903ed8ca73c1930fb9f14e2acaa9c2b456d85fd82c2254558eb85'
-            '064a82fb13816af5eb2a90bc8320d062ead0bf700715ee65df6afb347f890907'
+            '7b1974f7bba8ac4b76e51ef7fe1257d165c7c4abbd0915e192391336048a3d74'
+            '0e3f6b7fe700a3bbdf97bdae8655453b34b1bd08fa8ae339e0fd130fe8670b0b'
+            'c9ad78f3e2f0ffcb4ee66bb3e99249fcd283dc9fee17895b9265dc733288b953'
             '8a91ea49a1699c820c4a180710072cba1d6d5c10e45df97477ff6a898f4e1d70')
 
 prepare() {
@@ -41,6 +43,7 @@
   install -dm 755 "${pkgdir}"/{etc/conf.d,usr/{bin,lib/systemd/system}}
   cp -dr --no-preserve='ownership' build "${pkgdir}"/usr/lib/emby-server
   install -m 755 emby-server "${pkgdir}"/usr/bin/
+  install -m 755 emby-migrate-database "${pkgdir}"/usr/bin/
   install -m 644 emby-server.service "${pkgdir}"/usr/lib/systemd/system/
   install -m 644 emby-server.conf "${pkgdir}"/etc/conf.d/emby-server
 

Added: emby-migrate-database
===================================================================
--- emby-migrate-database	                        (rev 0)
+++ emby-migrate-database	2015-09-17 14:56:31 UTC (rev 140405)
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+USER='emby'
+GROUP='emby'
+
+usage() {
+  echo 'Usage: emby-migrate-database {-u user} {-g group} old_path_full new_path_full'
+  echo 'Default user: emby'
+  echo 'Default group: emby'
+}
+
+migrate() {
+  if [[ $1 && $2 ]]; then
+    if [[ -f $1/data/library.db ]]; then
+      if [[ ! -e $2 ]]; then
+        mkdir -p $2
+      fi
+      if [[ -d $2 ]]; then
+        if [[ -z $(ls $2) ]]; then
+          cp -r $1/* $2/
+          sqlite3 $2/data/library.db "UPDATE TypedBaseItems SET data = CAST(REPLACE(CAST(data AS TEXT), '$1', '$2') AS BLOB);"
+          chown $USER:$GROUP -R $2
+          echo "Migration complete. You can now delete $1."
+        else
+          echo "$2 is not empty. Aborting."
+        fi
+      else
+        echo "$2 is not a directory. Aborting."
+      fi
+    else
+      echo "$1 does not contain an emby database. Aborting."
+    fi
+  else
+    usage
+  fi
+}
+
+if [[ $1 == '--help' ]]; then
+  usage
+else
+  while getopts 'u:g:' opt; do
+    case $opt in
+      u)
+        USER=$OPTARG
+        ;;
+      g)
+        GROUP=$OPTARG
+        ;;
+      \?)
+        usage
+        ;;
+    esac
+  done
+  shift $((OPTIND-1))
+  migrate
+fi

Modified: emby-server
===================================================================
--- emby-server	2015-09-17 14:39:13 UTC (rev 140404)
+++ emby-server	2015-09-17 14:56:31 UTC (rev 140405)
@@ -1,3 +1,3 @@
-#! /bin/sh
+#!/bin/sh
 
-exec mono /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata $EMBY_HOME -ffmpeg ffmpeg -ffprobe ffprobe
+exec $MONO /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata $PROGRAM_DATA -ffmpeg $FFMPEG -ffprobe $FFPROBE

Modified: emby-server.conf
===================================================================
--- emby-server.conf	2015-09-17 14:39:13 UTC (rev 140404)
+++ emby-server.conf	2015-09-17 14:56:31 UTC (rev 140405)
@@ -1 +1,4 @@
-EMBY_HOME='/var/lib/emby'
+MONO=/usr/bin/mono
+FFMPEG=/usr/bin/ffmpeg
+FFPROBE=/usr/bin/ffprobe
+PROGRAM_DATA=/var/lib/emby

Modified: emby-server.install
===================================================================
--- emby-server.install	2015-09-17 14:39:13 UTC (rev 140404)
+++ emby-server.install	2015-09-17 14:56:31 UTC (rev 140405)
@@ -1,7 +1,27 @@
 post_install() {
-    getent group emby > /dev/null 2>&1 || groupadd -g 422 emby
-    getent passwd emby > /dev/null 2>&1 || useradd -c 'Emby Media Server' -u 422 -g emby -d /var/lib/emby -s /usr/bin/nologin emby
-    passwd -l emby > /dev/null
+  getent group emby > /dev/null 2>&1 || groupadd -g 422 emby
+  getent passwd emby > /dev/null 2>&1 || useradd -c 'Emby Media Server' -u 422 -g emby -d /var/lib/emby -s /usr/bin/nologin emby
+  passwd -l emby > /dev/null
+
+  if [[ -d '/var/lib/emby-server' ]]; then
+
+cat <<EOF
+
+New installations store the emby database inside '/var/lib/emby' (previously
+'/var/lib/emby-server'). Existing installations are left untouched.
+
+You can play safe and keep your existing setup, or you can adopt the new home
+and move your database using the emby-migrate-database script. Make sure to run
+pacdiff afterwards to merge the configuration changes.
+
+  sudo emby-migrate-database /var/lib/emby-server /var/lib/emby
+
+The script can also be used for more advanced database migration.
+Try "emby-migrate-database --help" for additional information.
+
+EOF
+
+  fi
 }
 
 post_upgrade() {



More information about the arch-commits mailing list