Remove restore passwd script 94/246494/1 accepted/tizen/unified/20201109.123536 submit/tizen/20201104.032152 submit/tizen/20201104.064230
authorJeon Sang-Heon <sh95.jeon@samsung.com>
Fri, 30 Oct 2020 14:12:51 +0000 (14:12 +0000)
committerJeon Sang-Heon <sh95.jeon@samsung.com>
Fri, 30 Oct 2020 14:12:56 +0000 (14:12 +0000)
When doing OS upgrade, restoring passwd should not be worked at initrd fota.
It will be added to rw migration script, so removed it first.

Change-Id: Iaf7b04261810682b5b7da478ef3f0f8cc24706ca
Signed-off-by: Jeon Sang-Heon <sh95.jeon@samsung.com>
packaging/initrd-fota.spec
scripts/fus_rw-init.sh
scripts/restore-passwd.sh [deleted file]

index 6635e46..c4f5f93 100755 (executable)
@@ -30,16 +30,12 @@ package for building partition image for RAMDISK2 (ramdisk-recovery.img)
 %install
 
 %define init_script_dir %{_libdir}/initrd-recovery/fota
-%define upgrade_dir %{_datadir}/upgrade
 
 mkdir -p %{buildroot}/opt/data/update
 
 mkdir -p %{buildroot}%{init_script_dir}
 cp ./scripts/fota-init.sh %{buildroot}%{init_script_dir}/fota-init.sh
 cp ./scripts/fus_rw-init.sh %{buildroot}%{init_script_dir}/fus_rw-init.sh
-# Pre-patch script
-mkdir -p %{buildroot}%{upgrade_dir}
-cp ./scripts/restore-passwd.sh %{buildroot}%{upgrade_dir}/restore-passwd.sh
 
 mkdir -p %{buildroot}%{_datadir}/initrd-recovery/initrd.list.d
 cp ./scripts/40-fota.list %{buildroot}%{_datadir}/initrd-recovery/initrd.list.d
@@ -48,6 +44,5 @@ cp ./scripts/40-fota.list %{buildroot}%{_datadir}/initrd-recovery/initrd.list.d
 %manifest initrd-fota.manifest
 %license LICENSE
 %attr(700,root,root) %{init_script_dir}/*.sh
-%attr(700,root,root) %{upgrade_dir}/restore-passwd.sh
 %attr(700,root,root) %{_datadir}/initrd-recovery/initrd.list.d/*.list
 %attr(777,system,system) /opt/data/update
index 1982888..ae4d4fc 100755 (executable)
@@ -82,9 +82,6 @@ do_reboot() {
 do_rw_update() {
        echo "Change into rw update mode" >> ${INT_LOG_FILE}
 
-       # Pre-patches
-       /bin/chroot ${FAKE_ROOT} /bin/sh -c /usr/share/upgrade/restore-passwd.sh
-
        # Go to system-update.target
        if [ $$ = 1 ]; then
                cd ${FAKE_ROOT}
diff --git a/scripts/restore-passwd.sh b/scripts/restore-passwd.sh
deleted file mode 100755 (executable)
index 6605943..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
-BACKUP_HELPER="/usr/share/upgrade/rw-update-macro.inc"
-ETC_DIR="/opt/etc"
-UID_REGULAR_USER_MIN=5001
-UID_REGULAR_USER_MAX=10000
-
-source $BACKUP_HELPER
-
-# Restore etc links
-cp -af "$ETC_DIR/passwd" "$ETC_DIR/old_passwd"
-cp -af "$ETC_DIR/shadow" "$ETC_DIR/old_shadow"
-cp -af "$ETC_DIR/group" "$ETC_DIR/old_group"
-cp -af "$ETC_DIR/gshadow" "$ETC_DIR/old_gshadow"
-restore_backup_file -f "$ETC_DIR/passwd"
-restore_backup_file -f "$ETC_DIR/passwd-"
-restore_backup_file -f "$ETC_DIR/passwd.old"
-restore_backup_file -f "$ETC_DIR/shadow"
-restore_backup_file -f "$ETC_DIR/shadow-"
-restore_backup_file -f "$ETC_DIR/shadow.old"
-restore_backup_file -f "$ETC_DIR/group"
-restore_backup_file -f "$ETC_DIR/group-"
-restore_backup_file -f "$ETC_DIR/group.old"
-restore_backup_file -f "$ETC_DIR/gshadow"
-restore_backup_file -f "$ETC_DIR/gshadow-"
-restore_backup_file -f "$ETC_DIR/gshadow.old"
-
-awk -F':' '('${UID_REGULAR_USER_MIN}' < $3 && $3 < '${UID_REGULAR_USER_MAX}'){system("/usr/bin/getent shadow " $1 " || /usr/bin/sed -n " NR "," NR "p '${ETC_DIR}'/old_shadow >> '${ETC_DIR}'/shadow")}' $ETC_DIR/old_passwd
-awk -F':' '('${UID_REGULAR_USER_MIN}' < $3 && $3 < '${UID_REGULAR_USER_MAX}'){system("/usr/bin/getent passwd " $1 " || /usr/bin/echo " $0 " >> '${ETC_DIR}'/passwd")}' $ETC_DIR/old_passwd
-
-rm $ETC_DIR/old_passwd
-rm $ETC_DIR/old_shadow
-rm $ETC_DIR/old_group
-rm $ETC_DIR/old_gshadow