Change smack label of smack_pre_labeling to floor(_) 17/316217/1 accepted/tizen/unified/20241216.010825 accepted/tizen/unified/x/20241218.032734 accepted/tizen/unified/x/asan/20241224.004500
authorDongsun Lee <ds73.lee@samsung.com>
Thu, 12 Dec 2024 01:29:35 +0000 (10:29 +0900)
committerDongsun Lee <ds73.lee@samsung.com>
Thu, 12 Dec 2024 01:29:35 +0000 (10:29 +0900)
Change-Id: Iac3386bb1c116a32d20f66a5e1800f23c56d79c7

smack/smack_default_labeling

index abe764eda0bddb52f7ddb353df58b73b60c4231f..8fa24b33d06a69cda5130abbb150c1f54493fe3f 100644 (file)
@@ -2,18 +2,25 @@
 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 ONLYCAP_LIST="/etc/smack/onlycap"
+INITIAL_BOOT_FLAG="/opt/share/security-config/.smack_pre_labeling"
 
 # check initial boot
 function check_init_boot
 {
-       if [ ! -e /opt/share/security-config/.smack_pre_labeling ]
+       if [ ! -e $INITIAL_BOOT_FLAG ]
        then
-               touch /opt/share/security-config/.smack_pre_labeling
                return 1
        fi
        return 0
 }
 
+# set initial boot flag
+function set_init_boot
+{
+       touch $INITIAL_BOOT_FLAG
+       chsmack -a "_" $INITIAL_BOOT_FLAG
+}
+
 # Set default smack label for the specific file or folder
 function set_smack_label
 {
@@ -33,6 +40,7 @@ check_init_boot
 if [ "$?" == 1 ] # Init boot case
 then
        set_smack_label
+       set_init_boot
 fi
 
 echo $(cat $ONLYCAP_LIST) > /sys/fs/smackfs/onlycap