export `tzplatform-get --user $NEW_USER TZ_USER_SHARE`
export `tzplatform-get --user $NEW_USER TZ_USER_DB`
+if [ ! -e /system-update ]
+then
/usr/bin/touch $TZ_USER_DB/.media.db
/usr/bin/chown multimedia_fw:multimedia_fw $TZ_USER_DB/.media.db
/usr/bin/chmod 0644 $TZ_USER_DB/.media.db
/usr/bin/chmod 0775 $TZ_USER_SHARE/media
/usr/bin/chmod -R 0777 $TZ_USER_SHARE/media/.thumb
/usr/bin/find $NEW_USER $TZ_USER_SHARE/media/.thumb -type d -exec /usr/bin/chsmack -a 'User::App::Shared' -t {} +
+fi
Name: media-server
Summary: A server for media content management
-Version: 0.3.0
+Version: 0.3.1
Release: 0
Group: Multimedia/Service
License: Apache-2.0
Source2: media-server-user.service
Source3: media-server-user.path
Source4: media-server.path
+Source5: media-server.upgrade.sh
Source1001: %{name}.manifest
Source1002: libmedia-utils.manifest
Source1003: libmedia-utils-devel.manifest
%define product_tv 0
%endif
+%define upgrade_script_path /usr/share/upgrade/scripts
+
%description
Description: A server for media content management.
cp -rf %{_builddir}/%{name}-%{version}/data/media.db %{buildroot}/etc/multimedia/.media.db
%endif
+#OS Upgrade
+mkdir -p %{buildroot}%{upgrade_script_path}
+cp -f %{SOURCE5} %{buildroot}%{upgrade_script_path}
+
%post
# setup dbupdate in user session
mkdir -p %{_unitdir_user}/basic.target.wants/
/etc/multimedia/.media.db
%{_datadir}/locale/*/LC_MESSAGES/*
%license LICENSE.APLv2.0
+%{upgrade_script_path}/media-server.upgrade.sh
%files -n libmedia-utils
%manifest libmedia-utils.manifest
--- /dev/null
+#!/bin/sh -e
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+# Macro
+DB_DIR_24=/opt/usr/dbspace
+DB_DIR_30=/opt/usr/home/owner/.applications/dbspace
+MEDIA_DIR_24=/opt/usr/media
+MEDIA_DIR_30=/opt/usr/home/owner/content
+SHARE_DIR_24=/opt/usr/share
+SHARE_DIR_30=/opt/usr/home/owner/share
+
+DB_FILE_24=$DB_DIR_24/.media.db
+DB_FILE_30=$DB_DIR_30/.media.db
+
+# Move
+mv $DB_FILE_24 $DB_FILE_30
+rm -f $DB_FILE_24-journal
+
+# DB update
+sqlite3 $DB_FILE_30 "UPDATE media SET path = replace( path, '/opt/usr/media', '/opt/usr/home/owner/content' ), thumbnail_path = NULL WHERE path LIKE '/opt/usr/media/%';
+UPDATE folder SET path = replace( path, '/opt/usr/media', '/opt/usr/home/owner/content' ) WHERE path LIKE '/opt/usr/media/%' OR path = '/opt/usr/media';
+DELETE FROM media WHERE path LIKE '/opt/storage/%';
+DELETE FROM folder WHERE path LIKE '/opt/storage/%';
+DELETE FROM storage WHERE storage_path LIKE '/opt/storage/%';
+"
+
+# Set permission
+touch $DB_FILE_30
+chown multimedia_fw:multimedia_fw $DB_FILE_30
+chmod 0644 $DB_FILE_30
+chsmack -a 'User::Home' $DB_FILE_30
+
+mkdir -p $SHARE_DIR_30/media/.thumb/phone
+mkdir -p $SHARE_DIR_30/media/.thumb/mmc
+chown -R multimedia_fw:multimedia_fw $SHARE_DIR_30/media
+chsmack -a 'User::App::Shared' -t $SHARE_DIR_30/media
+chmod 0775 $SHARE_DIR_30/media
+chmod -R 0777 $SHARE_DIR_30/media/.thumb
+find $SHARE_DIR_30/media/.thumb -type d -exec /usr/bin/chsmack -a 'User::App::Shared' -t {} +