common: Remove 'sudo' from shell scripts 20/310220/1
authorSangYoun Kwak <sy.kwak@samsung.com>
Fri, 19 Apr 2024 09:38:50 +0000 (18:38 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Wed, 24 Apr 2024 06:59:16 +0000 (15:59 +0900)
Since the delta-creating scripts are executed with root privilege, sudo
is unnecessary.

Change-Id: I9e612b06db62fca82af419980dc76232328f9bff
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
mk_delta/common/bin/mk_delta.sh
mk_delta/common/bin/mk_delta_full.sh
mk_delta/common/bin/mk_part_delta.sh

index 4889b5e..12638ea 100755 (executable)
@@ -57,7 +57,7 @@ fn_gen_update_cfg()
        PART_NUM=${line_num}
 
        if [ -f ${out_file} ]; then
-               sudo rm -fr ${out_file}
+               rm -fr ${out_file}
        fi
 
        for ((update_idx=0;update_idx<PART_NUM;update_idx++))
@@ -169,7 +169,7 @@ fn_print_update_cfg()
 #
 fn_build_update_info()
 {
-       sudo python3 "${UPDATE_INFO_BUILDER_PATH}" "${HAL_TARG_NAME}" "${ROOTFS_TARG_NAME}" "${TIZEN_TARG_NAME}" ${UPDATE_INFO_PATH}
+       python3 "${UPDATE_INFO_BUILDER_PATH}" "${HAL_TARG_NAME}" "${ROOTFS_TARG_NAME}" "${TIZEN_TARG_NAME}" ${UPDATE_INFO_PATH}
 
        rm -f  "${HAL_TARG_NAME}" "${ROOTFS_TARG_NAME}" "${TIZEN_TARG_NAME}"
 }
@@ -187,21 +187,21 @@ fn_process_extra_delta()
                        #--- delta recovery partition ---
                        ${MK_PART_DELTA} ${part_name} DELTA_IMAGE:AT_BOOT_FOTA ${part_bin} ${delta_bin}
                        if [ "$?" = "0" ]; then
-                               sudo mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
-                               sudo mv ${RESULT_DIR}/${part_bin}/${delta_bin} ${DELTA_DIR}
+                               mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
+                               mv ${RESULT_DIR}/${part_bin}/${delta_bin} ${DELTA_DIR}
                        fi
                fi
                if [ "${RAMDISK2_FULL_IMG}" = "1" ]; then
                        #--- full recovery partition ---
                        ${MK_PART_DELTA} ${part_name} FULL_IMAGE:AT_BOOT_FOTA ${part_bin} ${delta_bin}
                        if [ "$?" = "0" ]; then
-                               sudo mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
-                               sudo mv ${RESULT_DIR}/${part_bin}/${part_bin} ${DELTA_DIR}
+                               mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
+                               mv ${RESULT_DIR}/${part_bin}/${part_bin} ${DELTA_DIR}
                        fi
                fi
        elif [ "${part_name}" = "RECOVERY" ]; then
                #--- recovery kernel ---
-               sudo echo "1" > ${DELTA_DIR}/${delta_bin}
+               echo "1" > ${DELTA_DIR}/${delta_bin}
        elif [ "${part_name}" = "EXTRA" ]; then
                echo "---"
        fi
@@ -253,7 +253,7 @@ fn_extract_files_from_partition()
                return 1;
        fi
 
-       sudo mount -o loop "${IMAGE}" ${MNT_PNT}
+       mount -o loop "${IMAGE}" ${MNT_PNT}
        if [ "$?" != "0" ]; then
                return 1;
        fi
@@ -269,8 +269,8 @@ fn_extract_files_from_partition()
                cp "${ROOTFS_MODEL_CONFIG_PATH}" "${ROOTFS_TARG_NAME}"
                cp "${TIZEN_BUILD_CONFIG_PATH}" "${TIZEN_TARG_NAME}"
 
-               sudo umount ${MNT_PNT}
-               sudo rm -f "${IMAGE}"
+               umount ${MNT_PNT}
+               rm -f "${IMAGE}"
 
                fn_get_tar_file_names "$IMAGE" "${NEW_TAR_DIR}"
                tar xvf "${DATA_DIR}"/${NEW_TAR_DIR}/"${TAR_FILE_FOUND}" "${IMAGE}"
@@ -278,7 +278,7 @@ fn_extract_files_from_partition()
                        return 1;
                fi
 
-               sudo mount -o loop "${IMAGE}" ${MNT_PNT}
+               mount -o loop "${IMAGE}" ${MNT_PNT}
                if [ "$?" != "0" ]; then
                        return 1;
                fi
@@ -300,9 +300,9 @@ fn_extract_files_from_partition()
                # TODO buildstring?
        fi
 
-       sudo umount ${MNT_PNT}
-       sudo rm -rf ${MNT_PNT}
-       sudo rm -f "${IMAGE}"
+       umount ${MNT_PNT}
+       rm -rf ${MNT_PNT}
+       rm -f "${IMAGE}"
 }
 
 
@@ -356,23 +356,23 @@ do
                        ${MK_PART_DELTA} ${part_name} ${update_type} ${part_bin} ${delta_bin}
                        if [ "$?" = "0" ]; then
                                if [ "${update_type}" = "DELTA_FS" ]; then
-                                       sudo mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
-                                       sudo mv ${RESULT_DIR}/${part_bin} ${DELTA_DIR}
+                                       mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
+                                       mv ${RESULT_DIR}/${part_bin} ${DELTA_DIR}
                                else
-                                       sudo mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
-                                       sudo mv ${RESULT_DIR}/${part_bin}/${delta_bin} ${DELTA_DIR}
+                                       mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
+                                       mv ${RESULT_DIR}/${part_bin}/${delta_bin} ${DELTA_DIR}
                                fi
                                if [ "$?" != "0" ]; then
                                        echo "Warning: No differences - remove record for \"${part_name}\" from the final update.cfg"
                                        sed -i "/^${part_name}\b/d" "${UPDATE_CFG_PATH}"
                                fi
                        else
-                               sudo rm -rf ${RESULT_DIR}/${part_bin}
+                               rm -rf ${RESULT_DIR}/${part_bin}
                                echo "Error: Abort Delta Generation"
                                exit 1
                        fi
                fi
-               sudo rm -rf ${RESULT_DIR}/${part_bin}
+               rm -rf ${RESULT_DIR}/${part_bin}
        done
 
        if [ ! -s "${UPDATE_CFG_PATH}" ]; then
@@ -382,42 +382,42 @@ do
 
        #move update.cfg to delta directory
        if [ -r ${UPDATE_CFG_PATH} ]; then
-               sudo cp ${UPDATE_CFG_PATH} ${DELTA_DIR}/update.cfg
-               sudo rm ${UPDATE_CFG_PATH}
+               cp ${UPDATE_CFG_PATH} ${DELTA_DIR}/update.cfg
+               rm ${UPDATE_CFG_PATH}
        fi
        if [ -r ${LOG_PATH} ]; then
-               sudo cp ${LOG_PATH} ${RESULT_DIR}/Delta.log
-               sudo rm ${LOG_PATH}
+               cp ${LOG_PATH} ${RESULT_DIR}/Delta.log
+               rm ${LOG_PATH}
        fi
 
        if [ -r ${BUILD_STRING_PATH} ]; then
-               sudo cp ${BUILD_STRING_PATH} ${DELTA_DIR}/${BUILD_STRING_FILE}
-               sudo rm ${BUILD_STRING_PATH}
+               cp ${BUILD_STRING_PATH} ${DELTA_DIR}/${BUILD_STRING_FILE}
+               rm ${BUILD_STRING_PATH}
        fi
 
        if [ -r ${UPDATE_INFO_PATH} ]; then
-               sudo cp ${UPDATE_INFO_PATH} ${DELTA_DIR}/${UPDATE_INFO_FILE}
-               sudo rm ${UPDATE_INFO_PATH}
+               cp ${UPDATE_INFO_PATH} ${DELTA_DIR}/${UPDATE_INFO_FILE}
+               rm ${UPDATE_INFO_PATH}
        fi
 
        if [ -r ${SETUP_SCRIPT_PATH} ]; then
-               sudo cp ${SETUP_SCRIPT_PATH} ${DELTA_DIR}/setup.sh
+               cp ${SETUP_SCRIPT_PATH} ${DELTA_DIR}/setup.sh
        fi
 
        #--- archive result directory ---
        cd result/$MONDATE
        echo "tar result directory"
-       sudo tar cf ${MONDATE}_${Make_Delta}.tar $Make_Delta
+       tar cf ${MONDATE}_${Make_Delta}.tar $Make_Delta
        cd ../..
 
        echo "Making delta binary is End!! ($Make_Delta)"
 done
 
 if [ -r ${UPDATE_CFG_PATH} ]; then
-       sudo rm ${UPDATE_CFG_PATH}
+       rm ${UPDATE_CFG_PATH}
 fi
 cd ${DELTA_DIR}
-sudo cp ${COMMON_BINDIR}/unpack.sh ./
+cp ${COMMON_BINDIR}/unpack.sh ./
 
 if [ ! -r "${EXTRACTED_FILES_DIR}"/${UPGRADE_APPLY_BIN} ]; then
        fn_extract_files_from_partition rootfs.img
@@ -443,7 +443,7 @@ fn_build_update_info
 # Ensure essential files are at beginning of archive (metadata, scripts and binaries to perform upgrade)
 touch *.txt *.cfg *.ini *.sh *.inc
 sha1sum * > checksum.SHA1
-sudo tar --overwrite -cpf ../delta.tar $(ls -1td *)
+tar --overwrite -cpf ../delta.tar $(ls -1td *)
 
 SIGN_PKCS_FILE=$1
 SIGN_PKCS_PASSWORD=$2
@@ -451,7 +451,7 @@ if [ "z${SIGN_PKCS_FILE}" != "z" ]; then
        if [ "z${SIGN_PKCS_PASSWORD}" != "z" ]; then
                SIGNER_OPTIONAL_ARGUMENT="-p ${SIGN_PKCS_PASSWORD}"
        fi
-       sudo ${COMMON_BINDIR}/sign_img.sh -k ${SIGN_PKCS_FILE} -i ../delta.tar ${SIGNER_OPTIONAL_ARGUMENT}
+       ${COMMON_BINDIR}/sign_img.sh -k ${SIGN_PKCS_FILE} -i ../delta.tar ${SIGNER_OPTIONAL_ARGUMENT}
 fi
 cd -
 
index a9876c3..958f5ec 100755 (executable)
@@ -52,11 +52,11 @@ fn_extract_mounting_wrapper()
        fi
        local MNT_PNT="MNT_PNT"
        mkdir -p ${MNT_PNT}
-       sudo mount -o loop,ro "${DELTA_DIR}/${PART_BIN}" ${MNT_PNT}
+       mount -o loop,ro "${DELTA_DIR}/${PART_BIN}" ${MNT_PNT}
 
        fn_extract_needed_files ${MNT_PNT}
 
-       sudo umount ${MNT_PNT}
+       umount ${MNT_PNT}
        rm -rf ${MNT_PNT}
 }
 
@@ -165,8 +165,8 @@ fn_copy_image()
        SHA1_SUM=$(sha1sum ${DIR_WITH_IMAGES}/${PART_BIN} | awk '{print $1}')
        echo -e "\t\t${IMG_SIZE}\t[${SHA1_SUM}]"
 
-       sudo mv ${DIR_WITH_IMAGES}/${PART_BIN} ${DELTA_DIR}/${DELTA_BIN}
-       sudo chown ${MY_ID}:${MY_ID} ${DELTA_DIR}/${PART_BIN}
+       mv ${DIR_WITH_IMAGES}/${PART_BIN} ${DELTA_DIR}/${DELTA_BIN}
+       chown ${MY_ID}:${MY_ID} ${DELTA_DIR}/${PART_BIN}
 
        fn_extract_mounting_wrapper
 
@@ -175,7 +175,7 @@ fn_copy_image()
 
 fn_build_update_info()
 {
-       sudo python3 "${UPDATE_INFO_PATH}" ${HAL_EXCTRACTED} ${ROOTFS_EXCTRACTED} ${TIZEN_EXCTRACTED} ${UPDATE_INFO_FILE} --full_type
+       python3 "${UPDATE_INFO_PATH}" ${HAL_EXCTRACTED} ${ROOTFS_EXCTRACTED} ${TIZEN_EXCTRACTED} ${UPDATE_INFO_FILE} --full_type
 
        rm -f ${HAL_EXCTRACTED} ${ROOTFS_EXCTRACTED} ${TIZEN_EXCTRACTED}
 }
@@ -200,25 +200,25 @@ fn_make_delta_full()
 
        #move update.cfg to delta directory
        if [ -r ${UPDATE_CFG_PATH} ]; then
-               sudo cp ${UPDATE_CFG_PATH} ${DELTA_DIR}/update.cfg
-               sudo rm ${UPDATE_CFG_PATH}
+               cp ${UPDATE_CFG_PATH} ${DELTA_DIR}/update.cfg
+               rm ${UPDATE_CFG_PATH}
        fi
        if [ -r ${LOG_PATH} ]; then
-               sudo cp ${LOG_PATH} ${RESULT_DIR}/Delta.log
-               sudo rm ${LOG_PATH}
+               cp ${LOG_PATH} ${RESULT_DIR}/Delta.log
+               rm ${LOG_PATH}
        fi
 
        if [ -r ${BUILD_STRING_PATH} ]; then
-               sudo cp ${BUILD_STRING_PATH} ${DELTA_DIR}/${BUILD_STRING_FILE}
-               sudo rm ${BUILD_STRING_PATH}
+               cp ${BUILD_STRING_PATH} ${DELTA_DIR}/${BUILD_STRING_FILE}
+               rm ${BUILD_STRING_PATH}
        fi
 
        if [ -r ${SETUP_SCRIPT_PATH} ]; then
-               sudo cp ${SETUP_SCRIPT_PATH} ${DELTA_DIR}/setup.sh
+               cp ${SETUP_SCRIPT_PATH} ${DELTA_DIR}/setup.sh
        fi
 
        if [ -r ${DIR_WITH_IMAGES} ]; then
-               sudo rm -r ${DIR_WITH_IMAGES}
+               rm -r ${DIR_WITH_IMAGES}
        fi
 
        #--- archive result directory ---
@@ -232,7 +232,7 @@ fn_make_delta_full()
        touch *.sh *.inc *.txt *.cfg *.ini
        sha1sum * > checksum.SHA1
        echo "tar result directory"
-       sudo tar cf ../delta.tar *
+       tar cf ../delta.tar *
        popd
 
        echo "Making delta binary is End!!"
index a66d70d..2c18984 100755 (executable)
@@ -39,13 +39,13 @@ fn_extract_mounting_wrapper()
        mkdir -p ${MNT_PNT_OLD}
        mkdir -p ${MNT_PNT_NEW}
 
-       sudo mount -o loop,ro "${PART_IMG_OLD}" ${MNT_PNT_OLD}
-       sudo mount -o loop,ro "${PART_IMG_NEW}" ${MNT_PNT_NEW}
+       mount -o loop,ro "${PART_IMG_OLD}" ${MNT_PNT_OLD}
+       mount -o loop,ro "${PART_IMG_NEW}" ${MNT_PNT_NEW}
 
        fn_extract_needed_files ${MNT_PNT_OLD} ${MNT_PNT_NEW}
 
-       sudo umount ${MNT_PNT_OLD}
-       sudo umount ${MNT_PNT_NEW}
+       umount ${MNT_PNT_OLD}
+       umount ${MNT_PNT_NEW}
 
        rm -rf ${MNT_PNT_OLD}
        rm -rf ${MNT_PNT_NEW}
@@ -145,13 +145,13 @@ fn_mk_attribute()
 
        echo "Attribute generation for ${TARGET} [START] $(date +%T)"
 
-       sudo find ./${BASE_DIR_OLD} -type f -printf '"%P" Regular 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >  ${V1_ATTR_FILE}
-       sudo find ./${BASE_DIR_OLD} -type l -printf '"%P" SymLink 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >> ${V1_ATTR_FILE}
-       sudo find ./${BASE_DIR_OLD} -type d -printf '"%P" Regular 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >> ${V1_ATTR_FILE}
+       find ./${BASE_DIR_OLD} -type f -printf '"%P" Regular 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >  ${V1_ATTR_FILE}
+       find ./${BASE_DIR_OLD} -type l -printf '"%P" SymLink 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >> ${V1_ATTR_FILE}
+       find ./${BASE_DIR_OLD} -type d -printf '"%P" Regular 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >> ${V1_ATTR_FILE}
 
-       sudo find ./${BASE_DIR_NEW} -type f -printf '"%P" Regular 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >  ${V2_ATTR_FILE}
-       sudo find ./${BASE_DIR_NEW} -type l -printf '"%P" SymLink 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >> ${V2_ATTR_FILE}
-       sudo find ./${BASE_DIR_NEW} -type d -printf '"%P" Regular 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >> ${V2_ATTR_FILE}
+       find ./${BASE_DIR_NEW} -type f -printf '"%P" Regular 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >  ${V2_ATTR_FILE}
+       find ./${BASE_DIR_NEW} -type l -printf '"%P" SymLink 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >> ${V2_ATTR_FILE}
+       find ./${BASE_DIR_NEW} -type d -printf '"%P" Regular 14 %04m:%04U:%04G:' -exec ${COMMON_BINDIR}/${ATTR_CMD} {} \; >> ${V2_ATTR_FILE}
 
        ################ Change user and group permission from '0' to '0000' ############
        sed -i 's/:   0/:0000/g' ${V1_ATTR_FILE}
@@ -192,7 +192,7 @@ fn_mk_full_img()
                if [ "$?" != "0" ]; then
                        return 1;
                fi
-               sudo mv ${PART_IMG_ORG} ${PART_IMG_OLD}
+               mv ${PART_IMG_ORG} ${PART_IMG_OLD}
        fi
 
        echo "untar ${NEW_TAR_FILE}"
@@ -200,23 +200,23 @@ fn_mk_full_img()
        if [ "$?" != "0" ]; then
                return 1;
        fi
-       sudo mv ${PART_IMG_ORG} ${PART_IMG_NEW}
+       mv ${PART_IMG_ORG} ${PART_IMG_NEW}
 
        # after extraction, get neccessary files
        fn_extract_mounting_wrapper
 
        if [ ! "z${OLD_TAR_FILE}" = "z" ]; then
                #---- check whether the binaries are same ----
-               sudo diff ${PART_IMG_OLD} ${PART_IMG_NEW}
+               diff ${PART_IMG_OLD} ${PART_IMG_NEW}
                if [ "$?" = "0" ]; then
                        echo "[${PART_NAME}] two binaries are same"
-                       sudo rm -rf ${PART_IMG_OLD}
-                       sudo rm -rf ${PART_IMG_NEW}
+                       rm -rf ${PART_IMG_OLD}
+                       rm -rf ${PART_IMG_NEW}
                        return 0
                fi
-               sudo python3 ${COMMON_BINDIR}/CreatePatch.py ${UPDATE_TYPE} ${PART_NAME} ${PART_IMG_OLD} ${PART_IMG_NEW} ${OUTPUT_DIR} ${UPDATE_CFG_PATH}
+               python3 ${COMMON_BINDIR}/CreatePatch.py ${UPDATE_TYPE} ${PART_NAME} ${PART_IMG_OLD} ${PART_IMG_NEW} ${OUTPUT_DIR} ${UPDATE_CFG_PATH}
                PythonRet=$?
-               sudo rm ${PART_IMG_OLD}
+               rm ${PART_IMG_OLD}
 
                if [ $PythonRet != "0" ]; then
                        echo "[${PART_NAME}] Failed to generate DELTA"
@@ -224,8 +224,8 @@ fn_mk_full_img()
                fi
        fi
 
-       sudo mv ${PART_IMG_NEW} ${OUTPUT_DIR}/${PART_IMG_ORG}
-       sudo chown ${MY_ID}:${MY_ID} ${OUTPUT_DIR}/${PART_IMG_ORG}
+       mv ${PART_IMG_NEW} ${OUTPUT_DIR}/${PART_IMG_ORG}
+       chown ${MY_ID}:${MY_ID} ${OUTPUT_DIR}/${PART_IMG_ORG}
 
        return 0
 }
@@ -250,38 +250,38 @@ fn_mk_delta_img_core()
        if [ "$?" != "0" ]; then
                return 1;
        fi
-       sudo mv ${PART_IMG_ORG} ${PART_IMG_OLD}
+       mv ${PART_IMG_ORG} ${PART_IMG_OLD}
 
        echo "untar ${NEW_TAR_FILE}"
        tar xvf ${NEW_TAR_DIR}/${NEW_TAR_FILE} ${PART_IMG_ORG}
        if [ "$?" != "0" ]; then
                return 1;
        fi
-       sudo mv ${PART_IMG_ORG} ${PART_IMG_NEW}
+       mv ${PART_IMG_ORG} ${PART_IMG_NEW}
 
        # after extraction, get neccessary files
        fn_extract_mounting_wrapper
 
        #---- check whether the binaries are same ----
-       sudo diff ${PART_IMG_OLD} ${PART_IMG_NEW}
+       diff ${PART_IMG_OLD} ${PART_IMG_NEW}
        if [ "$?" = "0" ]; then
                echo "[${PART_NAME}] two binaries are same"
-               sudo rm -rf ${PART_IMG_OLD}
-               sudo rm -rf ${PART_IMG_NEW}
+               rm -rf ${PART_IMG_OLD}
+               rm -rf ${PART_IMG_NEW}
                return 0
        fi
 
        #---- make delta file ----
        echo "make ${DELTA}"
-       sudo python3 ${COMMON_BINDIR}/CreatePatch.py ${UPDATE_TYPE} ${PART_NAME} ${PART_IMG_OLD} ${PART_IMG_NEW} ${OUTPUT_DIR} ${UPDATE_CFG_PATH}
+       python3 ${COMMON_BINDIR}/CreatePatch.py ${UPDATE_TYPE} ${PART_NAME} ${PART_IMG_OLD} ${PART_IMG_NEW} ${OUTPUT_DIR} ${UPDATE_CFG_PATH}
        PythonRet=$?
-       #sudo xdelta delta ${PART_IMG_OLD} ${PART_IMG_NEW} ./${OUTPUT_DIR}/${PART_NAME}".delta"
+       #xdelta delta ${PART_IMG_OLD} ${PART_IMG_NEW} ./${OUTPUT_DIR}/${PART_NAME}".delta"
 
        #---- remove files & directories ----
        echo "remove temp files/directory & move delta/log to result directory"
-       sudo rm -rf ${PART_IMG_OLD}
-       sudo rm -rf ${PART_IMG_NEW}
-       sudo rm -rf x
+       rm -rf ${PART_IMG_OLD}
+       rm -rf ${PART_IMG_NEW}
+       rm -rf x
 
        if [ $PythonRet != "0" ]; then
                echo "[${PART_NAME}] Failed to generate DELTA"
@@ -359,22 +359,22 @@ fn_mk_delta_fs_core()
        if [ "$?" != "0" ]; then
                return 1;
        fi
-       sudo mv ${PART_IMG_ORG} ${PART_IMG_OLD}
+       mv ${PART_IMG_ORG} ${PART_IMG_OLD}
 
        echo "untar ${NEW_TAR_FILE}"
        tar xvf ${NEW_TAR_DIR}/${NEW_TAR_FILE} ${PART_IMG_ORG}
        if [ "$?" != "0" ]; then
                return 1;
        fi
-       sudo mv ${PART_IMG_ORG} ${PART_IMG_NEW}
+       mv ${PART_IMG_ORG} ${PART_IMG_NEW}
 
        #---- check whether the binaries are same ----
-       sudo diff ${PART_IMG_OLD} ${PART_IMG_NEW}
+       diff ${PART_IMG_OLD} ${PART_IMG_NEW}
        if [ "$?" = "0" ]; then
                echo "[${PART_NAME}] two binaries are same"
-               sudo rm -rf ${PART_IMG_OLD}
-               sudo rm -rf ${PART_IMG_NEW}
-               sudo rm -rf ${OUTPUT_DIR}
+               rm -rf ${PART_IMG_OLD}
+               rm -rf ${PART_IMG_NEW}
+               rm -rf ${OUTPUT_DIR}
                return 0
        fi
 
@@ -384,11 +384,11 @@ fn_mk_delta_fs_core()
 
        #---- mount partition image to mount point  ----
        echo "mount ${PART_IMG_OLD} & ${PART_IMG_NEW}"
-       sudo mount -o loop ${PART_IMG_OLD} ${MNT_PNT_OLD}
+       mount -o loop ${PART_IMG_OLD} ${MNT_PNT_OLD}
        if [ "$?" != "0" ]; then
                return 1;
        fi
-       sudo mount -o loop ${PART_IMG_NEW} ${MNT_PNT_NEW}
+       mount -o loop ${PART_IMG_NEW} ${MNT_PNT_NEW}
        if [ "$?" != "0" ]; then
                return 1;
        fi
@@ -399,32 +399,32 @@ fn_mk_delta_fs_core()
        #---- remove unnecessary files & directories  ----
        for ff in ${EXCLUDE_FILES}
        do
-               sudo rm -rf ${MNT_PNT_OLD}/${ff}
-               sudo rm -rf ${MNT_PNT_NEW}/${ff}
+               rm -rf ${MNT_PNT_OLD}/${ff}
+               rm -rf ${MNT_PNT_NEW}/${ff}
        done
 
        #---- make attribute ----
        fn_mk_attribute ${PART_NAME} ${BASE_OLD} ${BASE_NEW}
 
        #PART_IMG_ORG parameter should match with DELTA name that is part of default config file. Which will be used to update MAX size file that is present in respective partition.
-       sudo python3 ${COMMON_BINDIR}/CreatePatch.py ${UPDATE_TYPE} ${PART_NAME} ${BASE_OLD} ${BASE_NEW} ${OUTPUT_DIR} ${UPDATE_CFG_PATH} \
+       python3 ${COMMON_BINDIR}/CreatePatch.py ${UPDATE_TYPE} ${PART_NAME} ${BASE_OLD} ${BASE_NEW} ${OUTPUT_DIR} ${UPDATE_CFG_PATH} \
        --attr_old ${V1_ATTR_FILE} --attr_new ${V2_ATTR_FILE}
        PythonRet=$?
 
        #---- unmount partition image ----
        echo "umount ${MNT_PNT_OLD} & ${MNT_PNT_NEW}"
-       sudo umount ${MNT_PNT_OLD}
-       sudo umount ${MNT_PNT_NEW}
+       umount ${MNT_PNT_OLD}
+       umount ${MNT_PNT_NEW}
 
        #---- remove files & directories ----
        echo "remove temp files/directory & move delta/log to result directory"
-       sudo rm -rf ${PART_IMG_OLD}
-       sudo rm -rf ${PART_IMG_NEW}
-       sudo rm -rf ${BASE_OLD} ${BASE_NEW}
-       sudo rm -rf x
+       rm -rf ${PART_IMG_OLD}
+       rm -rf ${PART_IMG_NEW}
+       rm -rf ${BASE_OLD} ${BASE_NEW}
+       rm -rf x
 
        #---- extra cleanup ----
-       sudo mv ./file_attr_updated_image.txt ${OUTPUT_DIR}/${PART_NAME}_file_attr_updated_image.txt
+       mv ./file_attr_updated_image.txt ${OUTPUT_DIR}/${PART_NAME}_file_attr_updated_image.txt
 
        if [ $PythonRet != "0" ]; then
                echo "[${PART_NAME}] Failed to generate DELTA"
@@ -515,8 +515,8 @@ fn_mk_flash_img()
                return 1;
        fi
 
-       sudo mv ${PART_IMG_NEW} ${OUTPUT_DIR}/${PART_BIN}
-       sudo chown ${MY_ID}:${MY_ID} ${OUTPUT_DIR}/${PART_BIN}
+       mv ${PART_IMG_NEW} ${OUTPUT_DIR}/${PART_BIN}
+       chown ${MY_ID}:${MY_ID} ${OUTPUT_DIR}/${PART_BIN}
 
        return 0
 }
@@ -651,7 +651,7 @@ cd ${DATA_DIR} || exit 1
 OUTPUT_DIR=${PART_NAME}_OUT
 if [ ! -d ${OUTPUT_DIR} ]; then
        if [ -f ${OUTPUT_DIR} ]; then
-               sudo rm -f ${OUTPUT_DIR}
+               rm -f ${OUTPUT_DIR}
        fi
        mkdir ${OUTPUT_DIR}
 fi