Fix permissions for creation and deletion

This commit is contained in:
Jeremy Gardais 2018-12-28 08:52:20 +01:00
parent 0790dc35bc
commit 55b72cc978
1 changed files with 7 additions and 0 deletions

View File

@ -84,6 +84,8 @@ fi
wget -q "${USE_DEBIAN_ISO}" -O "${DEBIAN_DL_ISO_PATH}" wget -q "${USE_DEBIAN_ISO}" -O "${DEBIAN_DL_ISO_PATH}"
command 7z x -o"${TEMP_ISO_DIR}" -- "${DEBIAN_DL_ISO_PATH}" > /dev/null command 7z x -o"${TEMP_ISO_DIR}" -- "${DEBIAN_DL_ISO_PATH}" > /dev/null
rm -rf -- "${DEBIAN_DL_ISO_PATH}" rm -rf -- "${DEBIAN_DL_ISO_PATH}"
## Ensure to have the write permission on the extracted folder
chmod 0700 -- "${TEMP_ISO_DIR}"
# }}} # }}}
# Manage initrd.gz file {{{ # Manage initrd.gz file {{{
mkdir -- "${TEMP_INITRD_DIR}" mkdir -- "${TEMP_INITRD_DIR}"
@ -113,9 +115,13 @@ rm -rf -- "${TEMP_INITRD_DIR}"
chmod -w -R -- $(dirname -- "${INITRD_GZ_PATH}") chmod -w -R -- $(dirname -- "${INITRD_GZ_PATH}")
# }}} # }}}
# Generate new md5sum {{{ # Generate new md5sum {{{
## Ensure to have the write permission on the iso folder
chmod 0700 -- "${TEMP_ISO_DIR}"
cd -- "${TEMP_ISO_DIR}" > /dev/null || exit 2 cd -- "${TEMP_ISO_DIR}" > /dev/null || exit 2
## Exclude some unwanted files ## Exclude some unwanted files
find . -follow -type f -not \( -name "md5sum.txt" -o -name 'mkisofs' -o -name 'Bootable_NoEmulation.img' -o -path '*isolinux*' \) -exec md5sum {} \; > ./md5sum.txt find . -follow -type f -not \( -name "md5sum.txt" -o -name 'mkisofs' -o -name 'Bootable_NoEmulation.img' -o -path '*isolinux*' \) -exec md5sum {} \; > ./md5sum.txt
## Fix md5sum.txt permissions
chmod -w -- md5sum.txt
cd - > /dev/null || exit 2 cd - > /dev/null || exit 2
# }}} # }}}
# Generate new bootable iso {{{ # Generate new bootable iso {{{
@ -125,6 +131,7 @@ xorriso -as mkisofs -o "${DEBIAN_PRESEED_ISO_PATH}" \
-boot-load-size 4 -boot-info-table "${TEMP_ISO_DIR}" -boot-load-size 4 -boot-info-table "${TEMP_ISO_DIR}"
## Then remove temp iso directory ## Then remove temp iso directory
chmod u+w -R -- "${TEMP_ISO_DIR}"
rm -rf -- "${TEMP_ISO_DIR}" rm -rf -- "${TEMP_ISO_DIR}"
# }}} # }}}