Apply update path config 74/185574/1 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/5.0/unified/20181102.021246 accepted/tizen/unified/20180806.075504 submit/tizen/20180801.085411 submit/tizen/20180803.005755 submit/tizen_5.0/20181101.000004
authorSunmin Lee <sunm.lee@samsung.com>
Thu, 26 Jul 2018 04:54:33 +0000 (13:54 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Wed, 1 Aug 2018 00:46:08 +0000 (09:46 +0900)
The new platform config path TZ_SYS_UPGRADE is introduced.
Apply it to each file.

Change-Id: I7a9642e8ab9743d52e8e731970054f44b64b93c0
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
14 files changed:
CMakeLists.txt
packaging/system-rw-update.spec
units/offline-update.service [deleted file]
units/offline-update.service.in [new file with mode: 0644]
units/udev-sdb-init.service [deleted file]
units/udev-sdb-init.service.in [new file with mode: 0644]
upgrade/install-sdb-rule.sh [deleted file]
upgrade/install-sdb-rule.sh.in [new file with mode: 0755]
upgrade/record-version.sh [deleted file]
upgrade/record-version.sh.in [new file with mode: 0755]
upgrade/update-init.sh [deleted file]
upgrade/update-init.sh.in [new file with mode: 0755]
upgrade/update.sh [deleted file]
upgrade/update.sh.in [new file with mode: 0755]

index f291c002715adaf7758bdb664333701d6667b31f..4559f6b50c9b91d647c3f9a511e58727731fdb44 100755 (executable)
@@ -1,6 +1,13 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(rw-updater C)
 
+CONFIGURE_FILE(upgrade/install-sdb-rule.sh.in  upgrade/install-sdb-rule.sh  @ONLY)
+CONFIGURE_FILE(upgrade/update-init.sh.in       upgrade/update-init.sh       @ONLY)
+CONFIGURE_FILE(upgrade/update.sh.in            upgrade/update.sh            @ONLY)
+CONFIGURE_FILE(upgrade/record-version.sh.in    upgrade/record-version.sh    @ONLY)
+CONFIGURE_FILE(units/udev-sdb-init.service.in  units/udev-sdb-init.service  @ONLY)
+CONFIGURE_FILE(units/offline-update.service.in units/offline-update.service @ONLY)
+
 #add sub directory
 ADD_SUBDIRECTORY(rw-update-ani)
 ADD_SUBDIRECTORY(rstsmack)
index f9f70b7bed09a6550d3ef3d87173ff22fa909ffc..7145b3f63df66f92927e24fa1406edd8cc77687c 100644 (file)
@@ -1,6 +1,6 @@
 Name:       system-rw-update
 Summary:    System RW update management
-Version:    1.2.1
+Version:    1.2.2
 Release:    0
 Group:      Base/Startup
 License:    Apache-2.0
@@ -9,6 +9,7 @@ Source1001: %{name}.manifest
 Source1002: %{name}-ani.manifest
 
 BuildRequires: cmake
+BuildRequires: pkgconfig(libtzplatform-config)
 
 %description
 This package provides files for RW update
@@ -36,14 +37,24 @@ cp %{SOURCE1001} .
 cp %{SOURCE1002} .
 
 export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
-LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+LDFLAGS="$LDFLAGS"
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+       -DTZ_SYS_UPGRADE=%TZ_SYS_UPGRADE \
+       -DTZ_SYS_UPGRADE_SCRIPTS=%TZ_SYS_UPGRADE_SCRIPTS \
+       -DTZ_SYS_UPGRADE_DATA=%TZ_SYS_UPGRADE_DATA
 %__make %{?_smp_mflags}
 
 %install
 %make_install
 
-mkdir -p %{buildroot}%{_datadir}
-cp -r upgrade %{buildroot}%{_datadir}
+%define upgrade_dir %TZ_SYS_UPGRADE
+mkdir -p %{buildroot}%{upgrade_dir}
+cp upgrade/99-sdb-switch.rules %{buildroot}%{upgrade_dir}
+cp upgrade/install-sdb-rule.sh %{buildroot}%{upgrade_dir}
+cp upgrade/record-version.sh %{buildroot}%{upgrade_dir}
+cp upgrade/rw-update-macro.inc %{buildroot}%{upgrade_dir}
+cp upgrade/update-init.sh %{buildroot}%{upgrade_dir}
+cp upgrade/update.sh %{buildroot}%{upgrade_dir}
 mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants
 install -m 644 units/offline-update.service %{buildroot}%{_unitdir}
 ln -s ../offline-update.service %{buildroot}%{_unitdir}/system-update.target.wants/offline-update.service
@@ -65,7 +76,7 @@ if [ -e %{_libdir}/udev/rules.d/99-sdb-switch.rules ]; then
        echo "Exist 99-sdb-switch.rules, Skip!"
 else
        mkdir -p %{_libdir}/udev/rules.d
-       ln -s /opt/data/update/99-sdb-switch.rules %{_libdir}/udev/rules.d
+       ln -s %TZ_SYS_UPGRADE_DATA/99-sdb-switch.rules %{_libdir}/udev/rules.d
 fi
 if [ ! -e %{_bindir}/rstsmack ]; then
        ln -s %{_bindir}/rstsmack-for-update %{_bindir}/rstsmack
@@ -74,7 +85,7 @@ fi
 %files
 %manifest %{name}.manifest
 %license LICENSE.Apache-2.0
-%{_datadir}/upgrade/*
+%TZ_SYS_UPGRADE/*
 %{_unitdir}/offline-update.service
 %{_unitdir}/system-update.target.wants
 %{_unitdir}/udev-sdb-init.service
diff --git a/units/offline-update.service b/units/offline-update.service
deleted file mode 100644 (file)
index cb81600..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=System update script service
-DefaultDependencies=no
-Requires=sysinit.target
-After=sysinit.target
-
-[Service]
-Type=oneshot
-SmackProcessLabel=System::Privileged
-ExecStart=/usr/share/upgrade/update-init.sh
diff --git a/units/offline-update.service.in b/units/offline-update.service.in
new file mode 100644 (file)
index 0000000..5fb87e2
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=System update script service
+DefaultDependencies=no
+Requires=sysinit.target
+After=sysinit.target
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System::Privileged
+ExecStart=@TZ_SYS_UPGRADE@/update-init.sh
diff --git a/units/udev-sdb-init.service b/units/udev-sdb-init.service
deleted file mode 100644 (file)
index 893a1fb..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Install rule for udev sdb
-DefaultDependencies=no
-Before=sysinit.target systemd-udevd.service
-
-[Service]
-SmackProcessLabel=System
-Type=oneshot
-ExecStart=/usr/share/upgrade/install-sdb-rule.sh
diff --git a/units/udev-sdb-init.service.in b/units/udev-sdb-init.service.in
new file mode 100644 (file)
index 0000000..812610f
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Install rule for udev sdb
+DefaultDependencies=no
+Before=sysinit.target systemd-udevd.service
+
+[Service]
+SmackProcessLabel=System
+Type=oneshot
+ExecStart=@TZ_SYS_UPGRADE@/install-sdb-rule.sh
diff --git a/upgrade/install-sdb-rule.sh b/upgrade/install-sdb-rule.sh
deleted file mode 100755 (executable)
index 6bff17c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-SDB_RULE="99-sdb-switch.rules"
-DEST=/opt/data/update
-
-if [ ! -e ${DEST}/${SDB_RULE} ]; then
-       /bin/mkdir -p ${DEST}
-       /bin/cp /usr/share/upgrade/${SDB_RULE} ${DEST}
-fi
diff --git a/upgrade/install-sdb-rule.sh.in b/upgrade/install-sdb-rule.sh.in
new file mode 100755 (executable)
index 0000000..4adfaae
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+SDB_RULE="99-sdb-switch.rules"
+DEST=@TZ_SYS_UPGRADE_DATA@
+
+if [ ! -e ${DEST}/${SDB_RULE} ]; then
+       /bin/mkdir -p ${DEST}
+       /bin/cp @TZ_SYS_UPGRADE@/${SDB_RULE} ${DEST}
+fi
diff --git a/upgrade/record-version.sh b/upgrade/record-version.sh
deleted file mode 100755 (executable)
index 9f74a06..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-RW_MACRO=/usr/share/upgrade/rw-update-macro.inc
-
-if [ -e ${RW_MACRO} ]; then
-       source ${RW_MACRO}
-       write_version_info
-fi
diff --git a/upgrade/record-version.sh.in b/upgrade/record-version.sh.in
new file mode 100755 (executable)
index 0000000..4ce57d2
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+RW_MACRO=@TZ_SYS_UPGRADE@/rw-update-macro.inc
+
+if [ -e ${RW_MACRO} ]; then
+       source ${RW_MACRO}
+       write_version_info
+fi
diff --git a/upgrade/update-init.sh b/upgrade/update-init.sh
deleted file mode 100755 (executable)
index c57f52f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-#
-# RW update initialize script
-#
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
-RW_MACRO=/usr/share/upgrade/rw-update-macro.inc
-RW_UPDATE=/usr/share/upgrade/update.sh
-DEBUG_MODE=/opt/usr/.upgdebug
-
-if [ -f $RW_MACRO ]; then
-       source $RW_MACRO
-       get_version_info
-fi
-
-if [ ! "$OLD_VER" = "$NEW_VER" ]; then
-       # Restore rpm db
-       rm -rf /var/lib/rpm/*
-       restore_backup_file -f /opt/var/lib/rpm
-fi
-
-# Permission Update for shared directories
-/etc/gumd/useradd.d/91_user-dbspace-permissions.post owner
-
-sleep 10
-if [ -f $DEBUG_MODE ]; then
-       exit
-fi
-
-exec /bin/sh $RW_UPDATE
diff --git a/upgrade/update-init.sh.in b/upgrade/update-init.sh.in
new file mode 100755 (executable)
index 0000000..db05a1b
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# RW update initialize script
+#
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+RW_MACRO=@TZ_SYS_UPGRADE@/rw-update-macro.inc
+RW_UPDATE=@TZ_SYS_UPGRADE@/update.sh
+DEBUG_MODE=/opt/usr/.upgdebug
+
+if [ -f $RW_MACRO ]; then
+       source $RW_MACRO
+       get_version_info
+fi
+
+if [ ! "$OLD_VER" = "$NEW_VER" ]; then
+       # Restore rpm db
+       rm -rf /var/lib/rpm/*
+       restore_backup_file -f /opt/var/lib/rpm
+fi
+
+# Permission Update for shared directories
+/etc/gumd/useradd.d/91_user-dbspace-permissions.post owner
+
+sleep 10
+if [ -f $DEBUG_MODE ]; then
+       exit
+fi
+
+exec /bin/sh $RW_UPDATE
diff --git a/upgrade/update.sh b/upgrade/update.sh
deleted file mode 100755 (executable)
index 8ead592..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/sh
-#
-# RW update script
-#
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
-
-UPI_RW_UPDATE_ERROR=fa1a
-
-TMP_DIR=/tmp/upgrade
-PATCH_DIR=/usr/share/upgrade/scripts
-UPDATE_DIR=/opt/data/update
-LOG_FILE=${UPDATE_DIR}/rw_update.log
-RESULT_FILE=${UPDATE_DIR}/result
-SDB_RULE=${UPDATE_DIR}/99-sdb-switch.rules
-VERSION_FILE=/opt/etc/version
-RW_MACRO=/usr/share/upgrade/rw-update-macro.inc
-RUN=/bin/sh
-
-RW_GUI=
-RW_ANI=/usr/bin/rw-update-ani
-
-#------------------------------------------------
-#      shell script verity check
-#      return 0 : pass
-#      return 1 : no entry in rw-script.list
-#      return 2 : verity fail
-#------------------------------------------------
-Verity_Check() {
-
-       if [ "z$1" = "z" ]; then
-               echo "Input Shell Script Null" >> ${LOG_FILE}
-               return 1
-       fi
-
-       SC_FILE=`/usr/bin/basename $1`
-       SC_LIST=/usr/share/upgrade/rw-script.list
-       if [ -f ${SC_LIST} ]; then
-               grep ${SC_FILE} ${SC_LIST} > /dev/null 2>&1
-               if [ "$?" = "0" ]; then
-                       ret=`/usr/bin/md5sum "$1"`
-                       mret=($(/bin/echo $ret))
-                       md5result=${mret[0]}
-
-                       md5list=`/usr/bin/grep ${SC_FILE} ${SC_LIST} | /usr/bin/awk -F' ' '{print $2}'`
-                       if [ "$md5result" = "$md5list" ]; then
-                               echo "[PASS    ] ${SC_FILE} verity check" >> ${LOG_FILE}
-                               return 0
-                       else
-                               echo "[MISMATCH] ${SC_FILE} md5sum" >> ${LOG_FILE}
-                               return 2
-                       fi
-               else
-                       echo "[No entry] ${SC_FILE} in ${SC_LIST}" >> ${LOG_FILE}
-                       return 1
-               fi
-       else
-               echo "No such file ${SC_LIST}" >> ${LOG_FILE}
-               return 1
-       fi
-}
-
-#------------------------------------------------
-#      main
-#------------------------------------------------
-
-# Check GUI availability
-if [ -e ${RW_ANI} ]; then
-       RW_GUI=1
-fi
-
-mkdir -p ${RECOVERY_DIR}
-
-echo "System RW update: rw update started" > ${LOG_FILE}
-
-# Execute update scripts
-if [ ! -d ${PATCH_DIR} ]
-then
-       echo "FAIL: Upgrade directory does not exist" >> ${LOG_FILE}
-       echo "${UPI_RW_UPDATE_ERROR}" > ${RESULT_FILE}
-else
-       if [ "${RW_GUI}" = "1" ]; then
-               progress=0
-               total=`ls -l ${PATCH_DIR} | grep -c '^-'`
-               mkdir -p ${TMP_DIR}
-               echo ${total} > ${TMP_DIR}/total
-               export XDG_RUNTIME_DIR=/run
-               export TBM_DISPLAY_SERVER=1
-               /usr/bin/rw-update-ani --wait &
-       fi
-
-       PATCHES=`/bin/ls ${PATCH_DIR}`
-
-       for PATCH in ${PATCHES}; do
-               if [ "${RW_GUI}" = "1" ]; then
-                       progress=$((progress+1))
-                       echo ${progress} > ${TMP_DIR}/progress
-               fi
-               Verity_Check ${PATCH_DIR}/${PATCH}
-               # Skip in case of 'No entry' only
-               if [ "$?" != "1" ]; then
-                       ${RUN} ${PATCH_DIR}/${PATCH}
-               fi
-       done
-
-       sync
-
-       echo "SUCCESS: Upgrade successfully finished" >> ${LOG_FILE}
-fi
-
-if [ -e ${SDB_RULE} ]; then
-       rm ${SDB_RULE}
-fi
-
-if [ -e ${VERSION_FILE} ]; then
-       rm ${VERSION_FILE}
-       if [ -e ${RW_MACRO} ]; then
-               source ${RW_MACRO}
-               write_version_info
-       fi
-fi
-
-# Reboot
-reboot -f
diff --git a/upgrade/update.sh.in b/upgrade/update.sh.in
new file mode 100755 (executable)
index 0000000..999a71b
--- /dev/null
@@ -0,0 +1,124 @@
+#!/bin/sh
+#
+# RW update script
+#
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+UPI_RW_UPDATE_ERROR=fa1a
+
+TMP_DIR=/tmp/upgrade
+UPDATE_DIR=@TZ_SYS_UPGRADE@
+PATCH_DIR=@TZ_SYS_UPGRADE_SCRIPTS@
+UPDATE_DATA_DIR=@TZ_SYS_UPGRADE_DATA@
+LOG_FILE=${UPDATE_DATA_DIR}/rw_update.log
+RESULT_FILE=${UPDATE_DATA_DIR}/result
+SDB_RULE=${UPDATE_DATA_DIR}/99-sdb-switch.rules
+VERSION_FILE=/opt/etc/version
+RW_MACRO=${UPDATE_DIR}/rw-update-macro.inc
+RUN=/bin/sh
+
+RW_GUI=
+RW_ANI=/usr/bin/rw-update-ani
+
+#------------------------------------------------
+#      shell script verity check
+#      return 0 : pass
+#      return 1 : no entry in rw-script.list
+#      return 2 : verity fail
+#------------------------------------------------
+Verity_Check() {
+
+       if [ "z$1" = "z" ]; then
+               echo "Input Shell Script Null" >> ${LOG_FILE}
+               return 1
+       fi
+
+       SC_FILE=`/usr/bin/basename $1`
+       SC_LIST=${UPDATE_DIR}/rw-script.list
+       if [ -f ${SC_LIST} ]; then
+               grep ${SC_FILE} ${SC_LIST} > /dev/null 2>&1
+               if [ "$?" = "0" ]; then
+                       ret=`/usr/bin/md5sum "$1"`
+                       mret=($(/bin/echo $ret))
+                       md5result=${mret[0]}
+
+                       md5list=`/usr/bin/grep ${SC_FILE} ${SC_LIST} | /usr/bin/awk -F' ' '{print $2}'`
+                       if [ "$md5result" = "$md5list" ]; then
+                               echo "[PASS    ] ${SC_FILE} verity check" >> ${LOG_FILE}
+                               return 0
+                       else
+                               echo "[MISMATCH] ${SC_FILE} md5sum" >> ${LOG_FILE}
+                               return 2
+                       fi
+               else
+                       echo "[No entry] ${SC_FILE} in ${SC_LIST}" >> ${LOG_FILE}
+                       return 1
+               fi
+       else
+               echo "No such file ${SC_LIST}" >> ${LOG_FILE}
+               return 1
+       fi
+}
+
+#------------------------------------------------
+#      main
+#------------------------------------------------
+
+# Check GUI availability
+if [ -e ${RW_ANI} ]; then
+       RW_GUI=1
+fi
+
+mkdir -p ${RECOVERY_DIR}
+
+echo "System RW update: rw update started" > ${LOG_FILE}
+
+# Execute update scripts
+if [ ! -d ${PATCH_DIR} ]
+then
+       echo "FAIL: Upgrade directory does not exist" >> ${LOG_FILE}
+       echo "${UPI_RW_UPDATE_ERROR}" > ${RESULT_FILE}
+else
+       if [ "${RW_GUI}" = "1" ]; then
+               progress=0
+               total=`ls -l ${PATCH_DIR} | grep -c '^-'`
+               mkdir -p ${TMP_DIR}
+               echo ${total} > ${TMP_DIR}/total
+               export XDG_RUNTIME_DIR=/run
+               export TBM_DISPLAY_SERVER=1
+               /usr/bin/rw-update-ani --wait &
+       fi
+
+       PATCHES=`/bin/ls ${PATCH_DIR}`
+
+       for PATCH in ${PATCHES}; do
+               if [ "${RW_GUI}" = "1" ]; then
+                       progress=$((progress+1))
+                       echo ${progress} > ${TMP_DIR}/progress
+               fi
+               Verity_Check ${PATCH_DIR}/${PATCH}
+               # Skip in case of 'No entry' only
+               if [ "$?" != "1" ]; then
+                       ${RUN} ${PATCH_DIR}/${PATCH}
+               fi
+       done
+
+       sync
+
+       echo "SUCCESS: Upgrade successfully finished" >> ${LOG_FILE}
+fi
+
+if [ -e ${SDB_RULE} ]; then
+       rm ${SDB_RULE}
+fi
+
+if [ -e ${VERSION_FILE} ]; then
+       rm ${VERSION_FILE}
+       if [ -e ${RW_MACRO} ]; then
+               source ${RW_MACRO}
+               write_version_info
+       fi
+fi
+
+# Reboot
+reboot -f