index : archiso32 | |
Archlinux32 iso tools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | README.profile.rst | 24 | ||||
-rwxr-xr-x | archiso/mkarchiso | 36 |
diff --git a/README.profile.rst b/README.profile.rst new file mode 100644 index 0000000..7e8e177 --- /dev/null +++ b/README.profile.rst @@ -0,0 +1,24 @@ +======= +profile +======= + +An archiso profile consists of several configuration files and a directory for files to be added to the resulting image. + +pacman.conf +=========== + +A configuration for pacman is required per profile. + +Some configuration options will not be used or will be modified: + +* `CacheDir`: the profile's option is **only** used if it is not the default (i.e. `/var/cache/pacman/pkg`) and if it is + not the same as the system's option. In all other cases the system's pacman cache is used. +* `HookDir`: it is **always** set to the `/etc/pacman.d/hooks` airootfs directory in the work directories airootfs to + allow modification via the profile and ensure interoparability with hosts using dracut (see #73 for further + information) +* `RootDir`: it is **always** removed, as setting it explicitely otherwise refers to the host's root filesystem (see + `man 8 pacman` for further information on the `-r` option used by `pacstrap`) +* `LogFile`: it is **always** removed, as setting it explicitely otherwise refers to the host's pacman log file (see + `man 8 pacman` for further information on the `-r` option used by `pacstrap`) +* `DBPath`: it is **always** removed, as setting it explicitely otherwise refers to the host's pacman database (see + `man 8 pacman` for further information on the `-r` option used by `pacstrap`) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index b5c5150..9eca18b 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -202,9 +202,9 @@ _pacman() { _msg_info "Installing packages to '${airootfs_dir}/'..." if [[ "${quiet}" = "y" ]]; then - pacstrap -C "${pacman_conf}" -c -G -M -- "${airootfs_dir}" "$@" &> /dev/null + pacstrap -C "${work_dir}/pacman.conf" -c -G -M -- "${airootfs_dir}" "$@" &> /dev/null else - pacstrap -C "${pacman_conf}" -c -G -M -- "${airootfs_dir}" "$@" + pacstrap -C "${work_dir}/pacman.conf" -c -G -M -- "${airootfs_dir}" "$@" fi _msg_info "Done! Packages installed successfully." @@ -321,12 +321,32 @@ _run_once() { fi } -# Set up custom pacman.conf with current cache directories. +# Set up custom pacman.conf with custom cache and pacman hook directories _make_pacman_conf() { - local _cache_dirs - _cache_dirs="$(pacman-conf CacheDir)" - sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${_cache_dirs[*]//$'\n'/ }|g" \ - "${pacman_conf}" > "${work_dir}/pacman.conf" + local _cache_dirs _system_cache_dirs _profile_cache_dirs + _system_cache_dirs="$(pacman-conf CacheDir| tr '\n' ' ')" + _profile_cache_dirs="$(pacman-conf --config "${pacman_conf}" CacheDir| tr '\n' ' ')" + + # only use the profile's CacheDir, if it is not the default and not the same as the system cache dir + if [[ "${_profile_cache_dirs}" != "/var/cache/pacman/pkg" ]] && \ + [[ "${_system_cache_dirs}" != "${_profile_cache_dirs}" ]]; then + _cache_dirs="${_profile_cache_dirs}" + else + _cache_dirs="${_system_cache_dirs}" + fi + + _msg_info "Copying custom pacman.conf to work directory..." + # take the profile pacman.conf and strip all settings that would break in chroot when using pacman -r + # see `man 8 pacman` for further info + pacman-conf --config "${pacman_conf}" | \ + sed '/CacheDir/d;/DBPath/d;/HookDir/d;/LogFile/d;/RootDir/d' > "${work_dir}/pacman.conf" + + _msg_info "Using pacman CacheDir: ${_cache_dirs}" + # append CacheDir and HookDir to [options] section + # HookDir is *always* set to the airootfs' override directory + sed "/\[options\]/a CacheDir = ${_cache_dirs} + /\[options\]/a HookDir = ${airootfs_dir}/etc/pacman.d/hooks/" \ + -i "${work_dir}/pacman.conf" } # Prepare working directory and copy custom airootfs files (airootfs) @@ -336,7 +356,7 @@ _make_custom_airootfs() { install -d -m 0755 -o 0 -g 0 -- "${airootfs_dir}" if [[ -d "${profile}/airootfs" ]]; then - _msg_info "Copying custom custom airootfs files and setting up user home directories..." + _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" |