Pre condition
- USB memory stick formatted with ext4.
- There should be no regular files.
Problem
- Smack lable of /run is changed to "*".
Cause
- "find $MOUNT_DIRECTORY -type f | xargs" return blank if there is no files.
- storaged runs on "/"
- "chsmack -a '*'" changes all files in the current directory.
Solution
- runs xargs with "-r" option.
- Man page of xargs: "If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there is no input. This option is a GNU extension."
Change-Id: I642aaf84ea4752698eaa8be18fd105019779f86a
(cherry picked from commit
f316b1d3fc450a49291f881c065c66bd133923bf)
source /etc/tizen-platform.conf
MOUNT_DIRECTORY=$1
-find $MOUNT_DIRECTORY -type d | xargs chsmack -a '*' -t
-find $MOUNT_DIRECTORY -type f | xargs chsmack -a '*'
-find $MOUNT_DIRECTORY -type d | xargs chmod 777
-find $MOUNT_DIRECTORY -type f | xargs chmod 660
-find $MOUNT_DIRECTORY -type d | xargs chown root:priv_externalstorage
-find $MOUNT_DIRECTORY -type f | xargs chown root:priv_externalstorage
+find $MOUNT_DIRECTORY -type d | xargs -r chsmack -a '*' -t
+find $MOUNT_DIRECTORY -type f | xargs -r chsmack -a '*'
+find $MOUNT_DIRECTORY -type d | xargs -r chmod 777
+find $MOUNT_DIRECTORY -type f | xargs -r chmod 660
+find $MOUNT_DIRECTORY -type d | xargs -r chown root:priv_externalstorage
+find $MOUNT_DIRECTORY -type f | xargs -r chown root:priv_externalstorage