apply vdfs test patch
authorJiankang Fan <jiankang.fan@samsung.com>
Tue, 29 Nov 2016 08:06:17 +0000 (16:06 +0800)
committerJiankang Fan <jiankang.fan@samsung.com>
Thu, 1 Dec 2016 02:05:31 +0000 (10:05 +0800)
Change-Id: Ibbea537bd311e03af0f79334927e487d6163f997
Signed-off-by: Jiankang Fan <jiankang.fan@samsung.com>
cases/create/func_cases/mic_cr_auto_vdfs.case [new file with mode: 0644]
fixtures/ks_files/tizen_3.0_lite_vdfs.ks [new file with mode: 0644]

diff --git a/cases/create/func_cases/mic_cr_auto_vdfs.case b/cases/create/func_cases/mic_cr_auto_vdfs.case
new file mode 100644 (file)
index 0000000..6ec77b2
--- /dev/null
@@ -0,0 +1,24 @@
+<testcase>
+  <summary>test 'mic cr auto ks' for vdfs type
+if we run command with 'auto', mic will use the first line in ks file,
+which called magic line, and magic line in this ks file is:
+#-*-mic2-options-*- -f loop --pack-to=@NAME@.tar.gz --record-pkgs=name,content,license,vcs -*-mic2-options-*-
+  </summary>
+  <fixtures>
+    <copy src="ks_files/tizen_3.0_lite_vdfs.ks" />
+  </fixtures>
+  <steps><![CDATA[
+losetup_path=$(sudo which losetup)
+sudo $losetup_path -a
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+sudo mic -d -v cr auto tizen_3.0_lite_vdfs.ks --logfile=log.file
+grep "Finished" log.file
+sudo $losetup_path -a
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+ls mic-output/ | grep 'tizen_3.0_lite_vdfs.*tar.gz'
+]]></steps>
+  <teardown><![CDATA[
+echo "cleaning..."
+test -d ./mic-output && sudo rm -rf mic-output
+]]></teardown>
+</testcase>
diff --git a/fixtures/ks_files/tizen_3.0_lite_vdfs.ks b/fixtures/ks_files/tizen_3.0_lite_vdfs.ks
new file mode 100644 (file)
index 0000000..a267a2c
--- /dev/null
@@ -0,0 +1,457 @@
+# -*-mic2-options-*- -f loop --pack-to=@NAME@.tar --record-pkgs=name,content,license,vcs -*-mic2-options-*-
+
+# 
+# Do not Edit! Generated by:
+# kickstarter.py
+# 
+
+lang en_US.UTF-8
+keyboard us
+timezone --utc America/Los_Angeles
+# ROOT fs partition
+part / --size=3200 --ondisk mmcblk0p --fstype=vdfs --label=platform --vdfsoptions="-i,--sha256 -H /tmp/rsa1024_2016.debug.key.txt,-z 1433600K,--no-all-root,-q /tmp/config"
+# DATA partition
+part /opt/ --size=3200 --ondisk mmcblk0p --fstype=vdfs --label=do_not_use --vdfsoptions="-i,--image-size=835768K:4653240K,--no-all-root"
+# SYSTEM_RW partition
+part /mnt/systemrw --size=3200 --ondisk mmcblk0p --fstype=vdfs --label=systemrw --vdfsoptions="-i,-z 51200K,--no-all-root"
+
+rootpw tizen 
+xconfig --startxonboot
+bootloader  --timeout=0  --append="rootdelay=5"   
+
+desktop --autologinuser=guest  
+user --name guest  --groups audio,video --password 'tizen'
+
+
+repo --name=TZTV_Product --baseurl=http://168.219.244.109/releases/tizen-3.0-product-main2017/product/KantM/TIZEN-3.0-MAIN2017-KantM-RELEASE_20161129.3/repos/product/armv7l/packages --ssl_verify=no
+repo --name=Tizen-base --baseurl=http://168.219.244.109/tizen-rsa/tizen-3.0-base-main2017/standard/tizen-3.0-main2017-stan_20161128.1//repos/base/armv7l/packages/ --ssl_verify=no
+
+%packages
+
+@TV Base
+@TV Base Debug
+@TV COMMON
+@TV COMMON Debug
+@TV COMMON ATSC
+@TV COMMON ATSC Debug
+@TV KANTM
+@TV KANTM Debug
+
+
+lsb
+%end
+
+%prepackages
+coreutils
+factory-api-ATSC
+filesystem
+glibc
+kmod-compat
+libacl
+libattr
+libcap
+libcap-tools
+libgcc
+libncurses
+libreadline
+libres-lookup-ATSC
+libsqlite
+openssl
+setup
+setup-misc
+smack
+sqlite
+systemd
+tizen-platform-config
+toybox
+tztv-hawk-kmodules
+%end
+
+%attachment
+/var/tmp/kernel/uImage
+/var/tmp/kernel/dtb.bin
+/etc/include/partition.txt
+%end
+
+%post
+#!/bin/sh
+echo "#################### generic-base.post ####################"
+
+test ! -e /opt/var && mkdir -p /opt/var
+test -d /var && cp -arf /var/* /opt/var/
+rm -rf /var
+ln -snf opt/var /var
+
+test ! -e /opt/usr/home && mkdir -p /opt/usr/home
+test -d /home && cp -arf /home/* /opt/usr/home/
+rm -rf /home
+ln -snf opt/usr/home /home
+
+build_ts=$(date -u +%s)
+build_date=$(date -u --date @$build_ts +%Y%m%d_%H%M%S)
+build_time=$(date -u --date @$build_ts +%H:%M:%S)
+
+sed -ri \
+       -e 's|@BUILD_ID[@]|@BUILD_ID@|g' \
+       -e "s|@BUILD_DATE[@]|$build_date|g" \
+       -e "s|@BUILD_TIME[@]|$build_time|g" \
+       -e "s|@BUILD_TS[@]|$build_ts|g" \
+       /etc/tizen-build.conf
+
+# setup systemd default target for user session
+cat <<'EOF' >>/usr/lib/systemd/user/default.target
+[Unit]
+Description=User session default target
+EOF
+mkdir -p /usr/lib/systemd/user/default.target.wants
+
+# sdx: fix smack labels on /var/log
+chsmack -a '*' /var/log
+
+# create appfw dirs inside homes
+function generic_base_user_exists() {
+       user=$1
+       getent passwd | grep -q ^${user}:
+}
+
+function generic_base_user_home() {
+       user=$1
+       getent passwd | grep ^${user}: | cut -f6 -d':'
+}
+
+function generic_base_fix_user_homedir() {
+       user=$1
+       generic_base_user_exists $user || return 1
+
+       homedir=$(generic_base_user_home $user)
+       mkdir -p $homedir/apps_rw
+       for appdir in desktop manifest dbspace; do
+               mkdir -p $homedir/.applications/$appdir
+       done
+       find $homedir -type d -exec chsmack -a User {} \;
+       chown -R $user:users $homedir
+       return 0
+}
+
+# fix TC-320 for SDK
+. /etc/tizen-build.conf
+[ "${TZ_BUILD_WITH_EMULATOR}" == "1" ] && generic_base_fix_user_homedir developer
+
+# Add info.ini for system-info CAPI (TC-2047)
+/etc/make_info_file.sh
+
+#!/bin/sh
+echo "############### tv-base.post ################"
+
+if [ -d /opt/usr/home/owner ]; then
+    echo "[ERROR] '/opt/usr/home/owner' directory is already exist!!!"
+    rm -rf /tmp/ks-script* 2>/dev/null
+fi
+
+######### multiuser mode: create additional users and fix their homedirs
+
+perl -p -i -e 's/owner.*\n//g' /etc/passwd
+chmod +w /etc/shadow
+perl -p -i -e 's/owner.*\n//g' /etc/shadow
+chmod -w /etc/shadow
+if ! generic_base_user_exists owner; then
+       gum-utils --offline --add-user --username=owner --usertype=admin --usecret=tizen
+fi
+
+
+#!/bin/sh
+echo "#################### generic-console-tools.post ####################"
+
+# customize bash prompt
+cat >/etc/profile.d/bash_prompt_custom.sh <<'EOF'
+if [ "$PS1" ]; then
+
+       function proml {
+               # set a fancy prompt (overwrite the one in /etc/profile)
+               local default="\[\e[0m\]"
+               local usercol='\[\e[1;34m\]' # blue
+               local hostcol='\[\e[1;32m\]' # green
+               local pathcol='\[\e[1;33m\]' # yellow
+               local gitcol='\[\e[1;31m\]' # light red
+               local termcmd=''
+               local _p="$";
+
+               if [ "`id -u`" -eq 0 ]; then
+                       usercol='\[\e[1;31m\]'
+                       _p="#"
+               fi
+
+               PS1="${usercol}\u${default}@${hostcol}\h${default}:${pathcol}\w${default}${gitcol}${default}${_p} ${termcmd}"
+       }
+
+       proml
+
+       function rcd () {
+      [ "${1:0:1}" == "/" ] && { cd $1; } || { cd $(pwd -P)/$1; }
+   }
+
+       alias ll="ls -lZ"
+       alias lr="ls -ltrZ"
+       alias la="ls -alZ"
+
+       function get_manifest () {
+               rpm -qa --queryformat="%{name} %{Version} %{Release} %{VCS}\n" | sort
+       }
+fi
+EOF
+
+
+#!/bin/sh
+echo "#################### generic-packaging.post ####################"
+
+rm -rf /root/.zypp
+
+# was: rpm.post
+rm -f /var/lib/rpm/__db*
+rpmdb --rebuilddb
+
+
+#!/bin/sh
+echo "#################### generic-multimedia.post ####################"
+
+
+#!/bin/sh
+echo "#################### generic-desktop-applications.post ####################"
+
+# depends on generic-base functions
+function generic_desktop_applications_fix_userhome() {
+       user=$1
+
+       generic_base_user_exists $user || return 1
+       homedir=$(generic_base_user_home $user)
+
+       echo "Fix app_info.db of $user"
+       chown -R $user:users $homedir/.applications/dbspace/
+}
+
+# fix TC-320 for SDK
+. /etc/tizen-build.conf
+[ "${TZ_BUILD_WITH_EMULATOR}" == "1" ] && generic_desktop_applications_fix_userhome developer
+
+
+#!/bin/sh
+echo "############### tv-web-framework.post ################"
+
+# start wrt widgets preinstall
+prepare_widgets.sh
+
+
+#!/bin/sh
+echo "############### tv-user.post ################"
+
+for user in alice bob carol guest; do
+ if ! generic_base_user_exists $user; then
+  gum-utils --offline --add-user --username="$user" --usertype=normal --usecret=tizen
+ fi
+done
+
+
+echo 'kickstart post script start'
+if [ -d /etc/init.d ]; then
+    cp /etc/init.d/* /etc/rc.d/init.d/ -rdf --preserve=all
+fi
+rm -rf /etc/init.d*
+ln -sf /etc/rc.d/init.d /etc/init.d
+
+rm -rf /etc/localtime  
+ln -sf /opt/etc/localtime /etc/localtime  
+#rm -rf /usr/share/zoneinfo  
+#ln -sf /opt/share/zoneinfo /usr/share/zoneinfo 
+
+ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ""
+ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
+ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
+
+mkdir -p /usr/share/packages
+mkdir -p /opt/share/packages
+mkdir -p /opt/share/packages/.recovery
+mkdir -p /opt/share/applications
+
+# migration for vconf key
+/bin/sh /usr/etc/vconf/make_vconf_data.sh
+
+pkg_initdb all
+
+INITDB=1 ail_initdb
+
+# replace hosts file
+mv -f /etc/hosts.tmp /etc/hosts
+
+cat > /usr/bin/press << EOF
+#!/bin/sh
+
+JUNK="SLP"
+
+[ "\$1" ] && TIMEOUT="\$1" || TIMEOUT="1"
+
+echo "Press return key to stop scripts"
+read -t \$TIMEOUT JUNK
+exit \$?
+EOF
+chmod +x /usr/bin/press
+
+# [systemd] we need suid-root X for it to work from user-session
+#           Xorg will move to system, so this is temporary
+chmod 4755 /usr/bin/Xorg
+
+ln -s /opt/etc/X11/xkb /usr/share/X11
+
+echo "UDEV_PERSISTENT_STORAGE=no" >> /etc/sysconfig/udev
+
+# for QA
+mv /usr/include/python2.7/pyconfig.h /usr/pyconfig.h
+rm -rf /usr/include/*
+mkdir -p /usr/include/python2.7
+mv /usr/pyconfig.h /usr/include/python2.7/pyconfig.h
+#rm -rf /usr/include
+rm -rf /usr/share/man
+rm -rf /usr/share/doc
+
+ldconfig
+
+mkdir -p /opt/var/lib/dbus
+
+# read-writeable /var will be bind-mounted to /opt/var leaving rootfs read-only
+# below script more generic
+
+rm -f /var/lib/rpm/__db*
+rpm --rebuilddb
+cp -a /var /opt/ --preserve=all
+rm -rf /var
+ln -s /opt/var /var
+chsmack -a System /var/lib/buxton2/*
+chsmack -a System /var/lib/buxton2
+
+# directory for coredump creation
+
+mkdir /core
+chmod 757 /core
+
+# [systemd] some firstboot script like kbd could be done to image-creatation stage
+#           this patch is for it.
+for i in /etc/preconf.d/*; do
+    $i
+done
+
+# to fix factory localset issue - sh9119.jung@samsung.com
+/usr/bin/factory-api-post-atsc.sh
+
+# set software version
+# start_year : 2016
+# start_month : 8
+# model_name : T-KTMAKUC
+# mp_release : n
+/etc/make_prd_info_file.sh T-KTMAKUC T-KTMAKUC-0429.30 TIZEN-3.0-MAIN2017-KantM-RELEASE_20161129.3 debug
+
+# repack_rpm_files : prd-resource-provider-ATSC, etc/include/ATSC
+
+touch /etc/ATSC
+
+# repack_rpm_files : tztv-hawk-kmodules, include
+# repack_rpm_files : onboot, include
+# repack_rpm_files : seret4_UL, include
+# repack_rpm_files : trustzone-tee, include
+# repack_rpm_files : vd-kernel-dtb, include, ENCRYPT-DTB-PLATFORM.sh
+# repack_rpm_files : secure-driver, include
+
+touch /etc/debug
+
+
+# to provide partition map information to swu team - giljung.kim@samsung.com 
+cp -f /etc/include/partition_8G.txt /etc/include/partition.txt
+
+
+ln -sf /etc/prd_info.ini /opt/etc/prd_info.ini
+ln -sf /etc/prd_info.ini /usr/etc/prd_info.ini
+
+#reduce smack loading time 
+find $INSTALL_ROOT/opt/etc/smack/accesses.d -size 0 | xargs rm
+
+/etc/rc.d/init.d/smack_build_labeling
+/etc/rc.d/init.d/secanalyzer.sh
+
+# Make GStreamer registry
+/etc/gstreamer/gstreamer-registry.sh
+
+## make data_backup.img
+#/usr/bin/build-backup-data.sh
+
+# run remove unused locale script
+if [ -e /opt/locale/remove_unused_locale.sh ]; then
+    echo "run remove unused locale script"
+    /opt/locale/remove_unused_locale.sh
+    rm -rf /opt/locale/
+fi
+
+# run tv-viewer_privilege.py, requested by yeonwoo.kim
+if [ -e /opt/usr/apps/slive-provider/data/ks_script/tv-viewer_privilege.py ]; then
+    echo "run tv-viewer_privilege script"
+    python /opt/usr/apps/slive-provider/data/ks_script/tv-viewer_privilege.py
+fi
+
+# convert buxton base db to sqlite3(normal) db, requested by j39.kim
+if [ -e /etc/vconf/create_normal_db.sh ]; then
+    echo "run creating buxton normal db script"
+    /etc/vconf/create_normal_db.sh
+    rm -f /etc/vconf/create_normal_db.sh
+fi
+
+# TA Anti-Rollback, requested by kiuhae
+if [ -e /usr/apps/tee/version/mkversiondata.sh ]; then
+    /usr/apps/tee/version/mkversiondata.sh
+    rm -f /usr/apps/tee/version/mkversiondata.sh
+fi
+
+# Give capabilities to daemons via set_capability from security-config package
+if [ -e /usr/share/security-config/set_capability ]; then
+ echo 'Give capabilities to daemons via set_capability from security-config package'
+ /usr/share/security-config/set_capability
+fi 
+
+
+%end
+
+%post --nochroot
+# buildname.nochroot 
+if [ -n "$IMG_NAME" ]; then
+    echo "BUILD_ID=$IMG_NAME" >> $INSTALL_ROOT/etc/tizen-release
+    echo "BUILD_ID=$IMG_NAME" >> $INSTALL_ROOT/etc/os-release
+fi
+
+# Check ko files
+python /usr/sbin/check_ko.py $INSTALL_ROOT debug
+
+# Strip-all
+/usr/sbin/compose_strip_list.sh $INSTALL_ROOT
+#python /usr/sbin/strip.py $INSTALL_ROOT eu-strip
+vdfs_config() {
+    rm -f /tmp/config
+    echo "COMPRESS=zlib /" > /tmp/config
+    echo "We are created this vdfs config:"
+    cat /tmp/config
+}
+
+# Create vdfs config file
+vdfs_config
+
+# Prelink
+/usr/sbin/prelink.sh
+
+# sim tool
+if [ -e /usr/bin/sim_tool.sh ]; then
+    sh /usr/bin/sim_tool.sh
+fi
+
+# Checksum
+python /usr/sbin/checksum.py $INSTALL_ROOT
+
+# Copy vdfs authentication key
+cp /usr/bin/*.txt /tmp/
+
+
+%end