mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
code cleanup
This commit is contained in:
parent
38d5dd19dd
commit
1c067f1694
1 changed files with 13 additions and 13 deletions
|
@ -2,7 +2,7 @@
|
|||
# created by Tobias Powalowski <tpowa@archlinux.org>
|
||||
_PWD="$(pwd)"
|
||||
_BASENAME="$(basename "${0}")"
|
||||
_CACHEDIR=""$1"/var/cache/pacman/pkg"
|
||||
_CACHEDIR="$1/var/cache/pacman/pkg"
|
||||
_CLEANUP_CACHE=""
|
||||
_SAVE_RAM=""
|
||||
_LINUX_FIRMWARE="linux-firmware"
|
||||
|
@ -51,19 +51,19 @@ mkdir -p "${_CACHEDIR}"
|
|||
[[ -e "${_DIR}/dev" ]] || mkdir -m 755 "${_DIR}/dev"
|
||||
# mount special filesystems to ${_DIR}
|
||||
echo "Mount special filesystems in ${_DIR} ..."
|
||||
mount proc ""${_DIR}"/proc" -t proc -o nosuid,noexec,nodev
|
||||
mount sys ""${_DIR}"/sys" -t sysfs -o nosuid,noexec,nodev,ro
|
||||
mount udev ""${_DIR}"/dev" -t devtmpfs -o mode=0755,nosuid
|
||||
mount devpts ""${_DIR}"/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec
|
||||
mount shm ""${_DIR}"/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev
|
||||
mount proc "${_DIR}/proc" -t proc -o nosuid,noexec,nodev
|
||||
mount sys "${_DIR}/sys" -t sysfs -o nosuid,noexec,nodev,ro
|
||||
mount udev "${_DIR}/dev" -t devtmpfs -o mode=0755,nosuid
|
||||
mount devpts "${_DIR}/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec
|
||||
mount shm "${_DIR}/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev
|
||||
# install archboot
|
||||
echo "Installing packages base firmware and archboot to ${_DIR} ..."
|
||||
pacman --root "${_DIR}" -Sy base archboot "${_LINUX_FIRMWARE}" --ignore systemd-resolvconf --noconfirm --cachedir "${_PWD}"/"${_CACHEDIR}" >/dev/null 2>&1
|
||||
# umount special filesystems
|
||||
echo "Umount special filesystems in to ${_DIR} ..."
|
||||
umount -R ""${_DIR}"/proc"
|
||||
umount -R ""${_DIR}"/sys"
|
||||
umount -R ""${_DIR}"/dev"
|
||||
umount -R "${_DIR}/proc"
|
||||
umount -R "${_DIR}/sys"
|
||||
umount -R "${_DIR}/dev"
|
||||
# generate locales
|
||||
echo "Create locales in container ..."
|
||||
systemd-nspawn -D "${_DIR}" /bin/bash -c "echo 'en_US ISO-8859-1' >> /etc/locale.gen" >/dev/null 2>&1
|
||||
|
@ -83,11 +83,11 @@ sed -i -e 's:^CheckSpace:#CheckSpace:g' "${_DIR}"/etc/pacman.conf
|
|||
# enable parallel downloads
|
||||
sed -i -e 's:^#ParallelDownloads:ParallelDownloads:g' "${_DIR}"/etc/pacman.conf
|
||||
# enable [testing] if enabled in host
|
||||
if [[ "$(grep "^\[testing" /etc/pacman.conf)" ]]; then
|
||||
if grep -q "^\[testing" /etc/pacman.conf; then
|
||||
echo "Enable [testing] repository in container ..."
|
||||
sed -i -e '/^#\[testing\]/ { n ; s/^#// }' ${_DIR}/etc/pacman.conf
|
||||
sed -i -e '/^#\[community-testing\]/ { n ; s/^#// }' ${_DIR}/etc/pacman.conf
|
||||
sed -i -e 's:^#\[testing\]:\[testing\]:g' -e 's:^#\[community-testing\]:\[community-testing\]:g' ${_DIR}/etc/pacman.conf
|
||||
sed -i -e '/^#\[testing\]/ { n ; s/^#// }' "${_DIR}/etc/pacman.conf"
|
||||
sed -i -e '/^#\[community-testing\]/ { n ; s/^#// }' "${_DIR}/etc/pacman.conf"
|
||||
sed -i -e 's:^#\[testing\]:\[testing\]:g' -e 's:^#\[community-testing\]:\[community-testing\]:g' "${_DIR}/etc/pacman.conf"
|
||||
fi
|
||||
echo "Setting hostname to archboot ..."
|
||||
systemd-nspawn -D "${_DIR}" /bin/bash -c "echo archboot > /etc/hostname" >/dev/null 2>&1
|
||||
|
|
Loading…
Reference in a new issue