Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archiso
diff options
context:
space:
mode:
Diffstat (limited to 'archiso')
-rwxr-xr-xarchiso/mkarchiso41
1 files changed, 19 insertions, 22 deletions
diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index a3b1e53..99c8114 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -37,6 +37,7 @@ override_pacman_conf=""
bootmodes=()
airootfs_image_type="squashfs"
airootfs_image_tool_options=('-comp' 'xz')
+declare -A file_permissions=()
# Show an INFO message
@@ -257,30 +258,23 @@ _make_pacman_conf() {
# Prepare working directory and copy custom airootfs files (airootfs)
_make_custom_airootfs() {
local passwd=()
+ local filename permissions
install -d -m 0755 -o 0 -g 0 -- "${airootfs_dir}"
if [[ -d "${profile}/airootfs" ]]; then
- _msg_info "Copying custom airootfs files and setting up user home directories..."
- cp -af --no-preserve=ownership -- "${profile}/airootfs/." "${airootfs_dir}"
-
- [[ -e "${airootfs_dir}/etc/shadow" ]] && chmod -f 0400 -- "${airootfs_dir}/etc/shadow"
- [[ -e "${airootfs_dir}/etc/gshadow" ]] && chmod -f 0400 -- "${airootfs_dir}/etc/gshadow"
-
- # Set up user home directories and permissions
- if [[ -e "${airootfs_dir}/etc/passwd" ]]; then
- while IFS=':' read -a passwd -r; do
- [[ "${passwd[5]}" == '/' ]] && continue
- [[ -z "${passwd[5]}" ]] && continue
-
- if [[ -d "${airootfs_dir}${passwd[5]}" ]]; then
- chown -hR -- "${passwd[2]}:${passwd[3]}" "${airootfs_dir}${passwd[5]}"
- chmod -f 0750 -- "${airootfs_dir}${passwd[5]}"
- else
- install -d -m 0750 -o "${passwd[2]}" -g "${passwd[3]}" -- "${airootfs_dir}${passwd[5]}"
- fi
- done < "${airootfs_dir}/etc/passwd"
- fi
+ _msg_info "Copying custom airootfs files..."
+ cp -af --no-preserve=ownership,mode -- "${profile}/airootfs/." "${airootfs_dir}"
+ # Set ownership and mode for files and directories
+ for filename in "${!file_permissions[@]}"; do
+ IFS=':' read -ra permissions <<< "${file_permissions["${filename}"]}"
+ if [[ -e "${airootfs_dir}${filename}" ]]; then
+ chown -fh -- "${permissions[0]}:${permissions[1]}" "${airootfs_dir}${filename}"
+ chmod -f -- "${permissions[2]}" "${airootfs_dir}${filename}"
+ else
+ _msg_warning "Cannot change permissions of '${airootfs_dir}${filename}'. The file or directory does not exist."
+ fi
+ done
_msg_info "Done!"
fi
}
@@ -318,10 +312,12 @@ _make_customize_airootfs() {
(( passwd[2] >= 1000 && passwd[2] < 60000 )) || continue
[[ "${passwd[5]}" == '/' ]] && continue
[[ -z "${passwd[5]}" ]] && continue
- cp -dnRT --preserve=mode,timestamps,links -- "${airootfs_dir}/etc/skel" "${airootfs_dir}${passwd[5]}"
+ if [[ ! -d "${airootfs_dir}${passwd[5]}" ]]; then
+ install -d -m 0750 -o "${passwd[2]}" -g "${passwd[3]}" -- "${airootfs_dir}${passwd[5]}"
+ fi
+ cp -dnRT --preserve=mode,timestamps,links -- "${airootfs_dir}/etc/skel/." "${airootfs_dir}${passwd[5]}"
chmod -f 0750 -- "${airootfs_dir}${passwd[5]}"
chown -hR -- "${passwd[2]}:${passwd[3]}" "${airootfs_dir}${passwd[5]}"
-
done < "${profile}/airootfs/etc/passwd"
_msg_info "Done!"
fi
@@ -329,6 +325,7 @@ _make_customize_airootfs() {
if [[ -e "${airootfs_dir}/root/customize_airootfs.sh" ]]; then
_msg_info "Running customize_airootfs.sh in '${airootfs_dir}' chroot..."
_msg_warning "customize_airootfs.sh is deprecated! Support for it will be removed in a future archiso version."
+ chmod -f -- +x "${airootfs_dir}/root/customize_airootfs.sh"
eval -- arch-chroot "${airootfs_dir}" "/root/customize_airootfs.sh"
rm -- "${airootfs_dir}/root/customize_airootfs.sh"
_msg_info "Done! customize_airootfs.sh run successfully."