replace ${DESTDIR} with $DESTDIR in setup

This commit is contained in:
Tobias Powalowski 2011-02-03 22:20:37 +01:00
parent 24934321a6
commit 74553a3a79

View file

@ -17,7 +17,7 @@ KERNELPKG="kernel26"
[[ "$(cat /proc/cmdline | grep -w BOOT_IMAGE=.*lts)" ]] && KERNELPKG="kernel26-lts" [[ "$(cat /proc/cmdline | grep -w BOOT_IMAGE=.*lts)" ]] && KERNELPKG="kernel26-lts"
# abstract the common pacman args # abstract the common pacman args
PACMAN="pacman --root ${DESTDIR} --config /tmp/pacman.conf --noconfirm --noprogressbar" PACMAN="pacman --root $DESTDIR --config /tmp/pacman.conf --noconfirm --noprogressbar"
# downloader # downloader
DLPROG="wget" DLPROG="wget"
# sources # sources
@ -68,12 +68,12 @@ DIALOG() {
# #
chroot_mount() chroot_mount()
{ {
[[ -e "${DESTDIR}/sys" ]] || mkdir "${DESTDIR}/sys" [[ -e "$DESTDIR/sys" ]] || mkdir "$DESTDIR/sys"
[[ -e "${DESTDIR}/proc" ]] || mkdir "${DESTDIR}/proc" [[ -e "$DESTDIR/proc" ]] || mkdir "$DESTDIR/proc"
[[ -e "${DESTDIR}/dev" ]] || mkdir "${DESTDIR}/dev" [[ -e "$DESTDIR/dev" ]] || mkdir "$DESTDIR/dev"
mount -t sysfs sysfs "${DESTDIR}/sys" mount -t sysfs sysfs "$DESTDIR/sys"
mount -t proc proc "${DESTDIR}/proc" mount -t proc proc "$DESTDIR/proc"
mount -o bind /dev "${DESTDIR}/dev" mount -o bind /dev "$DESTDIR/dev"
} }
# chroot_umount() # chroot_umount()
@ -81,9 +81,9 @@ chroot_mount()
# #
chroot_umount() chroot_umount()
{ {
umount ${DESTDIR}/proc umount $DESTDIR/proc
umount ${DESTDIR}/sys umount $DESTDIR/sys
umount ${DESTDIR}/dev umount $DESTDIR/dev
} }
# getuuid() # getuuid()
@ -261,16 +261,16 @@ manual_media() {
} }
# destdir_mounts() # destdir_mounts()
# check if PART_ROOT is set and if something is mounted on ${DESTDIR} # check if PART_ROOT is set and if something is mounted on $DESTDIR
destdir_mounts(){ destdir_mounts(){
# Don't ask for filesystem and create new filesystems # Don't ask for filesystem and create new filesystems
ASK_MOUNTPOINTS="" ASK_MOUNTPOINTS=""
PART_ROOT="" PART_ROOT=""
# check if something is mounted on ${DESTDIR} # check if something is mounted on $DESTDIR
PART_ROOT="$(mount | grep "${DESTDIR} " | cut -d' ' -f 1)" PART_ROOT="$(mount | grep "$DESTDIR " | cut -d' ' -f 1)"
# Run mountpoints, if nothing is mounted on ${DESTDIR} # Run mountpoints, if nothing is mounted on $DESTDIR
if [[ "$PART_ROOT" = "" ]]; then if [[ "$PART_ROOT" = "" ]]; then
DIALOG --msgbox "Setup couldn't detect mounted partition(s) in ${DESTDIR}, please set mountpoints first." 0 0 DIALOG --msgbox "Setup couldn't detect mounted partition(s) in $DESTDIR, please set mountpoints first." 0 0
mountpoints || return 1 mountpoints || return 1
fi fi
} }
@ -565,13 +565,13 @@ findbootloaderpartitions() {
freeze_xfs() { freeze_xfs() {
sync sync
if [[ -x /usr/sbin/xfs_freeze ]]; then if [[ -x /usr/sbin/xfs_freeze ]]; then
if [[ "$(cat /proc/mounts | grep "${DESTDIR}/boot " | grep " xfs ")" ]]; then if [[ "$(cat /proc/mounts | grep "$DESTDIR/boot " | grep " xfs ")" ]]; then
/usr/sbin/xfs_freeze -f ${DESTDIR}/boot >/dev/null 2>&1 /usr/sbin/xfs_freeze -f $DESTDIR/boot >/dev/null 2>&1
/usr/sbin/xfs_freeze -u ${DESTDIR}/boot >/dev/null 2>&1 /usr/sbin/xfs_freeze -u $DESTDIR/boot >/dev/null 2>&1
fi fi
if [[ "$(cat /proc/mounts | grep "${DESTDIR} " | grep " xfs ")" ]]; then if [[ "$(cat /proc/mounts | grep "$DESTDIR " | grep " xfs ")" ]]; then
/usr/sbin/xfs_freeze -f ${DESTDIR} >/dev/null 2>&1 /usr/sbin/xfs_freeze -f $DESTDIR >/dev/null 2>&1
/usr/sbin/xfs_freeze -u ${DESTDIR} >/dev/null 2>&1 /usr/sbin/xfs_freeze -u $DESTDIR >/dev/null 2>&1
fi fi
fi fi
} }
@ -579,7 +579,7 @@ freeze_xfs() {
get_grub_map() { get_grub_map() {
rm /tmp/dev.map rm /tmp/dev.map
DIALOG --infobox "Generating GRUB device map...\nThis could take a while.\n\n Please be patient." 0 0 DIALOG --infobox "Generating GRUB device map...\nThis could take a while.\n\n Please be patient." 0 0
${DESTDIR}/sbin/grub --no-floppy --device-map /tmp/dev.map >/tmp/grub.log 2>&1 <<EOF $DESTDIR/sbin/grub --no-floppy --device-map /tmp/dev.map >/tmp/grub.log 2>&1 <<EOF
quit quit
EOF EOF
} }
@ -664,7 +664,7 @@ remove_grub_dmraid_hack(){
get_grub2_map() { get_grub2_map() {
rm /tmp/device.map rm /tmp/device.map
DIALOG --infobox "Generating GRUB2 device map...\nThis could take a while.\n\n Please be patient." 0 0 DIALOG --infobox "Generating GRUB2 device map...\nThis could take a while.\n\n Please be patient." 0 0
${DESTDIR}/sbin/grub-mkdevicemap --no-floppy --device-map=/tmp/device.map >>/tmp/grub2.log $DESTDIR/sbin/grub-mkdevicemap --no-floppy --device-map=/tmp/device.map >>/tmp/grub2.log
} }
mapdev() { mapdev() {
@ -725,7 +725,7 @@ printk()
} }
getdest() { getdest() {
[[ "${DESTDIR}" ]] && return 0 [[ "$DESTDIR" ]] && return 0
DIALOG --inputbox "Enter the destination directory where your target system is mounted" 8 65 "/tmp/install" 2>$ANSWER || return 1 DIALOG --inputbox "Enter the destination directory where your target system is mounted" 8 65 "/tmp/install" 2>$ANSWER || return 1
DESTDIR=$(cat $ANSWER) DESTDIR=$(cat $ANSWER)
} }
@ -830,8 +830,8 @@ _umountall()
{ {
DIALOG --infobox "Disabling swapspace, unmounting already mounted disk devices..." 0 0 DIALOG --infobox "Disabling swapspace, unmounting already mounted disk devices..." 0 0
swapoff -a >/dev/null 2>&1 swapoff -a >/dev/null 2>&1
umount $(mount | grep -v "${DESTDIR} " | grep "${DESTDIR}" | sed 's|\ .*||g') >/dev/null 2>&1 umount $(mount | grep -v "$DESTDIR " | grep "$DESTDIR" | sed 's|\ .*||g') >/dev/null 2>&1
umount $(mount | grep "${DESTDIR} " | sed 's|\ .*||g') >/dev/null 2>&1 umount $(mount | grep "$DESTDIR " | sed 's|\ .*||g') >/dev/null 2>&1
} }
# Disable all software raid devices # Disable all software raid devices
@ -1703,8 +1703,8 @@ autoprepare() {
fi fi
# validate DEST # validate DEST
if [[ ! -d "${DESTDIR}" ]]; then if [[ ! -d "$DESTDIR" ]]; then
DIALOG --msgbox "Destination directory '${DESTDIR}' is not valid" 0 0 DIALOG --msgbox "Destination directory '$DESTDIR' is not valid" 0 0
return 1 return 1
fi fi
@ -1769,7 +1769,7 @@ autoprepare() {
dosubvolume="no" dosubvolume="no"
if echo $mountpoint | tr -d ' ' | grep '^/$' 2>&1 >/dev/null; then if echo $mountpoint | tr -d ' ' | grep '^/$' 2>&1 >/dev/null; then
DIALOG --infobox "Creating $fstype on ${DEVICE}${part}" 0 0 DIALOG --infobox "Creating $fstype on ${DEVICE}${part}" 0 0
_mkfs yes ${DEVICE}${part} "$fstype" "${DESTDIR}" "$mountpoint" "$labelname" "$fsoptions" "$btrfsdevices" "$btrfssubvolume" "$btrfslevel" "$dosubvolume" "$btrfssd" "$btrfscompress" || return 1 _mkfs yes ${DEVICE}${part} "$fstype" "$DESTDIR" "$mountpoint" "$labelname" "$fsoptions" "$btrfsdevices" "$btrfssubvolume" "$btrfslevel" "$dosubvolume" "$btrfssd" "$btrfscompress" || return 1
fi fi
part=$(($part + 1)) part=$(($part + 1))
done done
@ -1790,7 +1790,7 @@ autoprepare() {
dosubvolume="no" dosubvolume="no"
if [[ "$(echo $mountpoint | tr -d ' ' | grep '^/$' | wc -l)" -eq 0 ]]; then if [[ "$(echo $mountpoint | tr -d ' ' | grep '^/$' | wc -l)" -eq 0 ]]; then
DIALOG --infobox "Creating $fstype on ${DEVICE}${part}" 0 0 DIALOG --infobox "Creating $fstype on ${DEVICE}${part}" 0 0
_mkfs yes ${DEVICE}${part} "$fstype" "${DESTDIR}" "$mountpoint" "$labelname" "$fsoptions" "$btrfsdevices" "$btrfssubvolume" "$btrfslevel" "$dosubvolume" "$btrfssd" "$btrfscompress" || return 1 _mkfs yes ${DEVICE}${part} "$fstype" "$DESTDIR" "$mountpoint" "$labelname" "$fsoptions" "$btrfsdevices" "$btrfssubvolume" "$btrfslevel" "$dosubvolume" "$btrfssd" "$btrfscompress" || return 1
fi fi
part=$(($part + 1)) part=$(($part + 1))
done done
@ -2384,16 +2384,16 @@ mountpoints() {
if [[ "$FSTYPE" = "swap" ]]; then if [[ "$FSTYPE" = "swap" ]]; then
DIALOG --infobox "Creating and activating swapspace on $PART" 0 0 DIALOG --infobox "Creating and activating swapspace on $PART" 0 0
else else
DIALOG --infobox "Creating $FSTYPE on $PART, mounting to ${DESTDIR}${MP}" 0 0 DIALOG --infobox "Creating $FSTYPE on $PART, mounting to $DESTDIR${MP}" 0 0
fi fi
_mkfs yes $PART $FSTYPE ${DESTDIR} $MP $LABEL_NAME $FS_OPTIONS $BTRFS_DEVICES $BTRFS_LEVEL $BTRFS_SUBVOLUME $DOSUBVOLUME $BTRFS_COMPRESS $BTRFS_SSD || return 1 _mkfs yes $PART $FSTYPE $DESTDIR $MP $LABEL_NAME $FS_OPTIONS $BTRFS_DEVICES $BTRFS_LEVEL $BTRFS_SUBVOLUME $DOSUBVOLUME $BTRFS_COMPRESS $BTRFS_SSD || return 1
else else
if [[ "$FSTYPE" = "swap" ]]; then if [[ "$FSTYPE" = "swap" ]]; then
DIALOG --infobox "Activating swapspace on $PART" 0 0 DIALOG --infobox "Activating swapspace on $PART" 0 0
else else
DIALOG --infobox "Mounting $FSTYPE on $PART to ${DESTDIR}${MP}" 0 0 DIALOG --infobox "Mounting $FSTYPE on $PART to $DESTDIR${MP}" 0 0
fi fi
_mkfs no $PART $FSTYPE ${DESTDIR} $MP $LABEL_NAME $FS_OPTIONS $BTRFS_DEVICES $BTRFS_LEVEL $BTRFS_SUBVOLUME $DOSUBVOLUME $BTRFS_COMPRESS $BTRFS_SSD || return 1 _mkfs no $PART $FSTYPE $DESTDIR $MP $LABEL_NAME $FS_OPTIONS $BTRFS_DEVICES $BTRFS_LEVEL $BTRFS_SUBVOLUME $DOSUBVOLUME $BTRFS_COMPRESS $BTRFS_SSD || return 1
fi fi
sleep 1 sleep 1
done done
@ -2612,7 +2612,7 @@ pacman_conf() {
cat << EOF > /tmp/pacman.conf cat << EOF > /tmp/pacman.conf
[options] [options]
Architecture = auto Architecture = auto
CacheDir = ${DESTDIR}/var/cache/pacman/pkg CacheDir = $DESTDIR/var/cache/pacman/pkg
CacheDir = /src/core-$(uname -m)/pkg CacheDir = /src/core-$(uname -m)/pkg
CacheDir = /src/core-any/pkg CacheDir = /src/core-any/pkg
@ -2629,8 +2629,8 @@ EOF
# returns: 1 on error # returns: 1 on error
prepare_pacman() { prepare_pacman() {
# Set up the necessary directories for pacman use # Set up the necessary directories for pacman use
[[ ! -d "${DESTDIR}/var/cache/pacman/pkg" ]] && mkdir -m 755 -p "${DESTDIR}/var/cache/pacman/pkg" [[ ! -d "$DESTDIR/var/cache/pacman/pkg" ]] && mkdir -m 755 -p "$DESTDIR/var/cache/pacman/pkg"
[[ ! -d "${DESTDIR}/var/lib/pacman" ]] && mkdir -m 755 -p "${DESTDIR}/var/lib/pacman" [[ ! -d "$DESTDIR/var/lib/pacman" ]] && mkdir -m 755 -p "$DESTDIR/var/lib/pacman"
DIALOG --infobox "Refreshing package database..." 6 45 DIALOG --infobox "Refreshing package database..." 6 45
$PACMAN -Sy >$LOG 2>&1 || return 1 $PACMAN -Sy >$LOG 2>&1 || return 1
@ -2882,12 +2882,12 @@ auto_fstab(){
# Modify fstab # Modify fstab
if [[ "$S_MKFS" = "1" || "$S_MKFSAUTO" = "1" ]]; then if [[ "$S_MKFS" = "1" || "$S_MKFSAUTO" = "1" ]]; then
if [[ -f /tmp/.device-names ]]; then if [[ -f /tmp/.device-names ]]; then
sort /tmp/.device-names >>${DESTDIR}/etc/fstab sort /tmp/.device-names >>$DESTDIR/etc/fstab
fi fi
if [[ -f /tmp/.fstab ]]; then if [[ -f /tmp/.fstab ]]; then
# clean fstab first from /dev entries # clean fstab first from /dev entries
sed -i -e '/^\/dev/d' ${DESTDIR}/etc/fstab sed -i -e '/^\/dev/d' $DESTDIR/etc/fstab
sort /tmp/.fstab >>${DESTDIR}/etc/fstab sort /tmp/.fstab >>$DESTDIR/etc/fstab
fi fi
fi fi
} }
@ -2896,21 +2896,21 @@ auto_fstab(){
# enable glibc locales from rc.conf and build initial locale DB # enable glibc locales from rc.conf and build initial locale DB
auto_locale() auto_locale()
{ {
for i in $(grep "^LOCALE" ${DESTDIR}/etc/rc.conf | sed -e 's/.*="//g' -e's/\..*//g'); do for i in $(grep "^LOCALE" $DESTDIR/etc/rc.conf | sed -e 's/.*="//g' -e's/\..*//g'); do
sed -i -e "s/^#$i/$i/g" ${DESTDIR}/etc/locale.gen sed -i -e "s/^#$i/$i/g" $DESTDIR/etc/locale.gen
done done
DIALOG --infobox "Generating glibc base locales..." 4 40 DIALOG --infobox "Generating glibc base locales..." 4 40
chroot ${DESTDIR} locale-gen >/dev/null 2>&1 chroot $DESTDIR locale-gen >/dev/null 2>&1
} }
# auto_mdadm() # auto_mdadm()
# add mdadm setup to existing /etc/mdadm.conf # add mdadm setup to existing /etc/mdadm.conf
auto_mdadm() auto_mdadm()
{ {
if [[ -e ${DESTDIR}/etc/mdadm.conf ]];then if [[ -e $DESTDIR/etc/mdadm.conf ]];then
if [[ "$(cat /proc/mdstat | grep ^md)" ]]; then if [[ "$(cat /proc/mdstat | grep ^md)" ]]; then
DIALOG --infobox "Adding raid setup to ${DESTDIR}/etc/mdadm.conf ..." 4 40 DIALOG --infobox "Adding raid setup to $DESTDIR/etc/mdadm.conf ..." 4 40
mdadm -Ds >> ${DESTDIR}/etc/mdadm.conf mdadm -Ds >> $DESTDIR/etc/mdadm.conf
fi fi
fi fi
} }
@ -2929,23 +2929,23 @@ auto_network()
DIALOG --yesno "Do you want to use the previous network settings in rc.conf and resolv.conf?\nIf you used Proxy settings, they will be written to /etc/profile.d/proxy.sh" 0 0 || return 1 DIALOG --yesno "Do you want to use the previous network settings in rc.conf and resolv.conf?\nIf you used Proxy settings, they will be written to /etc/profile.d/proxy.sh" 0 0 || return 1
if [[ "$S_DHCP" != "1" ]]; then if [[ "$S_DHCP" != "1" ]]; then
sed -i -e "s#^eth.*#$INTERFACE=\"$INTERFACE $IPADDR netmask $SUBNET broadcast $BROADCAST\"#g" ${DESTDIR}/etc/rc.conf sed -i -e "s#^eth.*#$INTERFACE=\"$INTERFACE $IPADDR netmask $SUBNET broadcast $BROADCAST\"#g" $DESTDIR/etc/rc.conf
if [[ "$GW" != "" ]]; then if [[ "$GW" != "" ]]; then
sed -i -e "s#gw 192.168.0.1#gw $GW#g" ${DESTDIR}/etc/rc.conf sed -i -e "s#gw 192.168.0.1#gw $GW#g" $DESTDIR/etc/rc.conf
sed -i -e "s#!gateway#gateway#g" ${DESTDIR}/etc/rc.conf sed -i -e "s#!gateway#gateway#g" $DESTDIR/etc/rc.conf
fi fi
echo "nameserver $DNS" >> ${DESTDIR}/etc/resolv.conf echo "nameserver $DNS" >> $DESTDIR/etc/resolv.conf
else else
sed -i -e "s#^eth.*#$INTERFACE=\"dhcp\"#g" ${DESTDIR}/etc/rc.conf sed -i -e "s#^eth.*#$INTERFACE=\"dhcp\"#g" $DESTDIR/etc/rc.conf
fi fi
sed -i -e "s#eth0)#$INTERFACE)#g" ${DESTDIR}/etc/rc.conf sed -i -e "s#eth0)#$INTERFACE)#g" $DESTDIR/etc/rc.conf
if [[ "$PROXY_HTTP" != "" ]]; then if [[ "$PROXY_HTTP" != "" ]]; then
echo "export http_proxy=$PROXY_HTTP" >> ${DESTDIR}/etc/profile.d/proxy.sh; echo "export http_proxy=$PROXY_HTTP" >> $DESTDIR/etc/profile.d/proxy.sh;
chmod a+x ${DESTDIR}/etc/profile.d/proxy.sh chmod a+x $DESTDIR/etc/profile.d/proxy.sh
fi fi
if [[ "$PROXY_FTP" != "" ]]; then if [[ "$PROXY_FTP" != "" ]]; then
echo "export ftp_proxy=$PROXY_FTP" >> ${DESTDIR}/etc/profile.d/proxy.sh; echo "export ftp_proxy=$PROXY_FTP" >> $DESTDIR/etc/profile.d/proxy.sh;
chmod a+x ${DESTDIR}/etc/profile.d/proxy.sh chmod a+x $DESTDIR/etc/profile.d/proxy.sh
fi fi
} }
@ -3056,12 +3056,12 @@ ROOTFS="$(blkid -c /dev/null $PART_ROOT -o value -s TYPE)"
getrootflags() { getrootflags() {
# remove gcpid for nilfs2 # remove gcpid for nilfs2
ROOTFLAGS="$(findmnt -m -n -o options -T ${DESTDIR} | sed -e 's/,gcpid=.*[0-9]//g')" ROOTFLAGS="$(findmnt -m -n -o options -T $DESTDIR | sed -e 's/,gcpid=.*[0-9]//g')"
} }
getraidarrays() { getraidarrays() {
RAIDARRAYS="" RAIDARRAYS=""
if ! [[ "$(grep ^ARRAY ${DESTDIR}/etc/mdadm.conf)" ]]; then if ! [[ "$(grep ^ARRAY $DESTDIR/etc/mdadm.conf)" ]]; then
RAIDARRAYS="$(echo -n $(cat /proc/mdstat 2>/dev/null | grep ^md | sed -e 's#\[[0-9]\]##g' -e 's# :.* raid[0-9]##g' -e 's#md#md=#g' -e 's# #,/dev/#g' -e 's#_##g'))" RAIDARRAYS="$(echo -n $(cat /proc/mdstat 2>/dev/null | grep ^md | sed -e 's#\[[0-9]\]##g' -e 's# :.* raid[0-9]##g' -e 's#md#md=#g' -e 's# #,/dev/#g' -e 's#_##g'))"
fi fi
} }
@ -3115,7 +3115,7 @@ common_bootloader_checks() {
# look for a separately-mounted /boot partition # look for a separately-mounted /boot partition
check_bootpart() { check_bootpart() {
subdir="" subdir=""
bootdev=$(mount | grep ${DESTDIR}/boot | cut -d' ' -f 1) bootdev=$(mount | grep $DESTDIR/boot | cut -d' ' -f 1)
if [[ "$bootdev" = "" ]]; then if [[ "$bootdev" = "" ]]; then
subdir=/boot subdir=/boot
bootdev=$PART_ROOT bootdev=$PART_ROOT
@ -3142,7 +3142,7 @@ abort_nilfs_bootpart() {
# install syslinux and run preparation # install syslinux and run preparation
prepare_syslinux () { prepare_syslinux () {
if ! [[ -e "${DESTDIR}/sbin/extlinux" || -e "${DESTDIR}/usr/bin/mcopy" ]]; then if ! [[ -e "$DESTDIR/sbin/extlinux" || -e "$DESTDIR/usr/bin/mcopy" ]]; then
DIALOG --msgbox "Couldn't find bootloader binary or helper program, installing syslinux now ..." 0 0 DIALOG --msgbox "Couldn't find bootloader binary or helper program, installing syslinux now ..." 0 0
PACKAGES="$SYSLINUX_PACKAGES" PACKAGES="$SYSLINUX_PACKAGES"
run_pacman run_pacman
@ -3165,8 +3165,8 @@ common_syslinux () {
ROOTDEV=$(cat $ANSWER) ROOTDEV=$(cat $ANSWER)
# generate config file # generate config file
TEMPDIR=/tmp TEMPDIR=/tmp
MBR=${DESTDIR}/usr/lib/syslinux/mbr.bin MBR=$DESTDIR/usr/lib/syslinux/mbr.bin
GPTMBR=${DESTDIR}/usr/lib/syslinux/gptmbr.bin GPTMBR=$DESTDIR/usr/lib/syslinux/gptmbr.bin
# check if GPT/GUID is used # check if GPT/GUID is used
GUID_DETECTED= GUID_DETECTED=
[[ "$(parted -s $ROOTDEV print | grep "Partition Table: gpt")" ]] && GUID_DETECTED=1 [[ "$(parted -s $ROOTDEV print | grep "Partition Table: gpt")" ]] && GUID_DETECTED=1
@ -3231,9 +3231,9 @@ EOF
$EDITOR ${TEMPDIR}/${SYSLINUX_CONF} $EDITOR ${TEMPDIR}/${SYSLINUX_CONF}
# install syslinux # install syslinux
DIALOG --infobox "Installing the $SYSLINUX bootloader..." 0 0 DIALOG --infobox "Installing the $SYSLINUX bootloader..." 0 0
! [[ -d ${DESTDIR}/boot/${SYSLINUX_DIR} ]] && mkdir -p ${DESTDIR}/boot/${SYSLINUX_DIR} ! [[ -d $DESTDIR/boot/${SYSLINUX_DIR} ]] && mkdir -p $DESTDIR/boot/${SYSLINUX_DIR}
cp ${TEMPDIR}/${SYSLINUX_CONF} ${DESTDIR}/boot/${SYSLINUX_DIR}/${SYSLINUX_CONF} cp ${TEMPDIR}/${SYSLINUX_CONF} $DESTDIR/boot/${SYSLINUX_DIR}/${SYSLINUX_CONF}
cp ${DESTDIR}/usr/lib/syslinux/*.c32 ${DESTDIR}/boot/${SYSLINUX_DIR} cp $DESTDIR/usr/lib/syslinux/*.c32 $DESTDIR/boot/${SYSLINUX_DIR}
if [[ "$GUID_DETECTED" = "" ]]; then if [[ "$GUID_DETECTED" = "" ]]; then
cat ${MBR} > ${ROOTDEV} cat ${MBR} > ${ROOTDEV}
else else
@ -3248,7 +3248,7 @@ finish_syslinux () {
DIALOG --msgbox "Error installing $SYSLINUX. (see $LOG for output)" 0 0 DIALOG --msgbox "Error installing $SYSLINUX. (see $LOG for output)" 0 0
return 1 return 1
fi fi
[[ -f "/src/boot/syslinux/splash.png" ]] && cp /src/boot/syslinux/splash.png ${DESTDIR}/boot/$SYSLINUX_DIR [[ -f "/src/boot/syslinux/splash.png" ]] && cp /src/boot/syslinux/splash.png $DESTDIR/boot/$SYSLINUX_DIR
chroot_umount chroot_umount
# make partition with /boot active! # make partition with /boot active!
@ -3310,7 +3310,7 @@ doextlinux () {
fi fi
common_syslinux common_syslinux
chroot_mount chroot_mount
chroot ${DESTDIR} $SYSLINUX_PROGRAM $SYSLINUX_OPTS --install /boot/$SYSLINUX_DIR >$LOG 2>&1 chroot $DESTDIR $SYSLINUX_PROGRAM $SYSLINUX_OPTS --install /boot/$SYSLINUX_DIR >$LOG 2>&1
finish_syslinux finish_syslinux
} }
@ -3326,7 +3326,7 @@ dosyslinux() {
SYSLINUX_PROGRAM=syslinux SYSLINUX_PROGRAM=syslinux
prepare_syslinux prepare_syslinux
# look for a separately-mounted /boot partition # look for a separately-mounted /boot partition
bootdev=$(mount | grep ${DESTDIR}/boot | cut -d' ' -f 1) bootdev=$(mount | grep $DESTDIR/boot | cut -d' ' -f 1)
if [[ "$bootdev" = "" ]]; then if [[ "$bootdev" = "" ]]; then
DIALOG --msgbox "Error:\nCouldn't find separate /boot partition." 0 0 DIALOG --msgbox "Error:\nCouldn't find separate /boot partition." 0 0
return 1 return 1
@ -3344,13 +3344,13 @@ dosyslinux() {
fi fi
common_syslinux || return 1 common_syslinux || return 1
chroot_mount chroot_mount
chroot ${DESTDIR} $SYSLINUX_PROGRAM $bootdev >$LOG 2>&1 chroot $DESTDIR $SYSLINUX_PROGRAM $bootdev >$LOG 2>&1
finish_syslinux finish_syslinux
} }
dolilo() { dolilo() {
if [[ ! -f ${DESTDIR}/etc/lilo.conf ]]; then if [[ ! -f $DESTDIR/etc/lilo.conf ]]; then
DIALOG --msgbox "Couldn't find ${DESTDIR}/etc/lilo.conf, installing lilo now ..." 0 0 DIALOG --msgbox "Couldn't find $DESTDIR/etc/lilo.conf, installing lilo now ..." 0 0
PACKAGES="lilo" PACKAGES="lilo"
run_pacman run_pacman
# reset PACKAGES after installing # reset PACKAGES after installing
@ -3368,17 +3368,17 @@ dolilo() {
# Try to auto-configure LILO... # Try to auto-configure LILO...
if ! [[ "$PART_ROOT" = "" ]]; then if ! [[ "$PART_ROOT" = "" ]]; then
if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then
sed -i "s|.*root=.*$|append=\"root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP\"|g" ${DESTDIR}/etc/lilo.conf sed -i "s|.*root=.*$|append=\"root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP\"|g" $DESTDIR/etc/lilo.conf
else else
sed -i "s|.*root=.*$|append=\"root=${PART_ROOT} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP\"|g" ${DESTDIR}/etc/lilo.conf sed -i "s|.*root=.*$|append=\"root=${PART_ROOT} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP\"|g" $DESTDIR/etc/lilo.conf
fi fi
sed -i "s|image=/boot/vmlinuz26|image=/boot/$VMLINUZ|g" ${DESTDIR}/etc/lilo.conf sed -i "s|image=/boot/vmlinuz26|image=/boot/$VMLINUZ|g" $DESTDIR/etc/lilo.conf
sed -i "s|initrd=.*kernel26.*fallback.img$|initrd=/boot/$KERNELPKG-fallback.img|g" ${DESTDIR}/etc/lilo.conf sed -i "s|initrd=.*kernel26.*fallback.img$|initrd=/boot/$KERNELPKG-fallback.img|g" $DESTDIR/etc/lilo.conf
sed -i "s|initrd=.*kernel26.img$|initrd=/boot/$KERNELPKG.img|g" ${DESTDIR}/etc/lilo.conf sed -i "s|initrd=.*kernel26.img$|initrd=/boot/$KERNELPKG.img|g" $DESTDIR/etc/lilo.conf
sed -i "s|initrd=.*kernel26-lts.img$|initrd=/boot/$KERNELPKG.img|g" ${DESTDIR}/etc/lilo.conf sed -i "s|initrd=.*kernel26-lts.img$|initrd=/boot/$KERNELPKG.img|g" $DESTDIR/etc/lilo.conf
fi fi
sed -i -e '/DEVICE DETAILS/d' ${DESTDIR}/etc/lilo.conf sed -i -e '/DEVICE DETAILS/d' $DESTDIR/etc/lilo.conf
sort /tmp/.device-names >> ${DESTDIR}/etc/lilo.conf sort /tmp/.device-names >> $DESTDIR/etc/lilo.conf
DEVS="$(findbootloaderdisks _)" DEVS="$(findbootloaderdisks _)"
DEVS="$DEVS $(findbootloaderpartitions _)" DEVS="$DEVS $(findbootloaderpartitions _)"
if [[ "$DEVS" = "" ]]; then if [[ "$DEVS" = "" ]]; then
@ -3387,19 +3387,19 @@ dolilo() {
fi fi
DIALOG --menu "Select the boot device where the LILO bootloader will be installed (usually the MBR)" 14 55 7 $DEVS 2>$ANSWER || return 1 DIALOG --menu "Select the boot device where the LILO bootloader will be installed (usually the MBR)" 14 55 7 $DEVS 2>$ANSWER || return 1
ROOTDEV=$(cat $ANSWER) ROOTDEV=$(cat $ANSWER)
sed -i "s|boot=.*$|boot=$ROOTDEV|g" ${DESTDIR}/etc/lilo.conf sed -i "s|boot=.*$|boot=$ROOTDEV|g" $DESTDIR/etc/lilo.conf
# HACK: if virtio device is used # HACK: if virtio device is used
if [[ "$(echo $ROOTDEV | grep /dev/vd)" ]]; then if [[ "$(echo $ROOTDEV | grep /dev/vd)" ]]; then
sed -i "s|.*disk=.*$|disk=$ROOTDEV bios=0x80 max-partitions=7|g" ${DESTDIR}/etc/lilo.conf sed -i "s|.*disk=.*$|disk=$ROOTDEV bios=0x80 max-partitions=7|g" $DESTDIR/etc/lilo.conf
else else
sed -i "s|^disk=.*$|# disk=$ROOTDEV bios=0x80|g" ${DESTDIR}/etc/lilo.conf sed -i "s|^disk=.*$|# disk=$ROOTDEV bios=0x80|g" $DESTDIR/etc/lilo.conf
fi fi
DIALOG --msgbox "Before installing LILO, you must review the configuration file. You will now be put into the editor. After you save your changes and exit the editor, LILO will be installed." 0 0 DIALOG --msgbox "Before installing LILO, you must review the configuration file. You will now be put into the editor. After you save your changes and exit the editor, LILO will be installed." 0 0
geteditor || return 1 geteditor || return 1
$EDITOR ${DESTDIR}/etc/lilo.conf $EDITOR $DESTDIR/etc/lilo.conf
DIALOG --infobox "Installing the LILO bootloader..." 0 0 DIALOG --infobox "Installing the LILO bootloader..." 0 0
chroot_mount chroot_mount
chroot ${DESTDIR} /sbin/lilo >$LOG 2>&1 chroot $DESTDIR /sbin/lilo >$LOG 2>&1
if [[ $? -gt 0 ]]; then if [[ $? -gt 0 ]]; then
chroot_umount chroot_umount
DIALOG --msgbox "Error installing LILO. (see $LOG for output)" 0 0 DIALOG --msgbox "Error installing LILO. (see $LOG for output)" 0 0
@ -3410,12 +3410,12 @@ dolilo() {
} }
dogrub() { dogrub() {
if [[ -f ${DESTDIR}/boot/grub2/grub.cfg ]]; then if [[ -f $DESTDIR/boot/grub2/grub.cfg ]]; then
DIALOG --msgbox "Found ${DESTDIR}/boot/grub2/grub.cfg, deinstalling grub2 now ..." 0 0 DIALOG --msgbox "Found $DESTDIR/boot/grub2/grub.cfg, deinstalling grub2 now ..." 0 0
$PACMAN -R grub2 > $LOG $PACMAN -R grub2 > $LOG
fi fi
if [[ ! -f ${DESTDIR}/boot/grub/menu.lst ]]; then if [[ ! -f $DESTDIR/boot/grub/menu.lst ]]; then
DIALOG --msgbox "Couldn't find ${DESTDIR}/boot/grub/menu.lst, installing grub now ..." 0 0 DIALOG --msgbox "Couldn't find $DESTDIR/boot/grub/menu.lst, installing grub now ..." 0 0
PACKAGES="grub" PACKAGES="grub"
run_pacman run_pacman
# reset PACKAGES after installing # reset PACKAGES after installing
@ -3496,9 +3496,9 @@ dogrub() {
return 1 return 1
fi fi
if [[ "$_grubdev" != "" ]]; then if [[ "$_grubdev" != "" ]]; then
cp ${DESTDIR}/boot/grub/menu.lst /tmp/.menu.lst cp $DESTDIR/boot/grub/menu.lst /tmp/.menu.lst
# remove the default entries by truncating the file at our little tag (#-*) # remove the default entries by truncating the file at our little tag (#-*)
head -n $(cat /tmp/.menu.lst | grep -n '#-\*' | cut -d: -f 1) /tmp/.menu.lst >${DESTDIR}/boot/grub/menu.lst head -n $(cat /tmp/.menu.lst | grep -n '#-\*' | cut -d: -f 1) /tmp/.menu.lst >$DESTDIR/boot/grub/menu.lst
rm -f /tmp/.menu.lst rm -f /tmp/.menu.lst
# keep the file from being completely bogus # keep the file from being completely bogus
if [[ "$_grubdev" = "DEVICE NOT FOUND" ]]; then if [[ "$_grubdev" = "DEVICE NOT FOUND" ]]; then
@ -3507,46 +3507,46 @@ dogrub() {
fi fi
NUMBER=0 NUMBER=0
# create default grub entries # create default grub entries
sort /tmp/.device-names >>${DESTDIR}/boot/grub/menu.lst sort /tmp/.device-names >>$DESTDIR/boot/grub/menu.lst
for grubdev in $_grubdev; do for grubdev in $_grubdev; do
echo "" >>${DESTDIR}/boot/grub/menu.lst echo "" >>$DESTDIR/boot/grub/menu.lst
echo "# ($NUMBER) Arch Linux" >>${DESTDIR}/boot/grub/menu.lst echo "# ($NUMBER) Arch Linux" >>$DESTDIR/boot/grub/menu.lst
echo "title Arch Linux" >>${DESTDIR}/boot/grub/menu.lst echo "title Arch Linux" >>$DESTDIR/boot/grub/menu.lst
echo "root $grubdev" >>${DESTDIR}/boot/grub/menu.lst echo "root $grubdev" >>$DESTDIR/boot/grub/menu.lst
if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then
echo "kernel $subdir/$VMLINUZ root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro" | sed -e 's# # #g' | sed -e 's# # #g' >>${DESTDIR}/boot/grub/menu.lst echo "kernel $subdir/$VMLINUZ root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro" | sed -e 's# # #g' | sed -e 's# # #g' >>$DESTDIR/boot/grub/menu.lst
else else
echo "kernel $subdir/$VMLINUZ root=$PART_ROOT rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro" | sed -e 's# # #g' | sed -e 's# # #g' >>${DESTDIR}/boot/grub/menu.lst echo "kernel $subdir/$VMLINUZ root=$PART_ROOT rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro" | sed -e 's# # #g' | sed -e 's# # #g' >>$DESTDIR/boot/grub/menu.lst
fi fi
echo "initrd $subdir/$KERNELPKG.img" >>${DESTDIR}/boot/grub/menu.lst echo "initrd $subdir/$KERNELPKG.img" >>$DESTDIR/boot/grub/menu.lst
echo "" >>${DESTDIR}/boot/grub/menu.lst echo "" >>$DESTDIR/boot/grub/menu.lst
# adding fallback/full image # adding fallback/full image
NUMBER=$(($NUMBER+1)) NUMBER=$(($NUMBER+1))
echo "# ($NUMBER) Arch Linux" >>${DESTDIR}/boot/grub/menu.lst echo "# ($NUMBER) Arch Linux" >>$DESTDIR/boot/grub/menu.lst
echo "title Arch Linux Fallback" >>${DESTDIR}/boot/grub/menu.lst echo "title Arch Linux Fallback" >>$DESTDIR/boot/grub/menu.lst
echo "root $grubdev" >>${DESTDIR}/boot/grub/menu.lst echo "root $grubdev" >>$DESTDIR/boot/grub/menu.lst
if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then
echo "kernel $subdir/$VMLINUZ root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro" | sed -e 's# # #g' | sed -e 's# # #g' >>${DESTDIR}/boot/grub/menu.lst echo "kernel $subdir/$VMLINUZ root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro" | sed -e 's# # #g' | sed -e 's# # #g' >>$DESTDIR/boot/grub/menu.lst
else else
echo "kernel $subdir/$VMLINUZ root=$PART_ROOT rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro" | sed -e 's# # #g' | sed -e 's# # #g' >>${DESTDIR}/boot/grub/menu.lst echo "kernel $subdir/$VMLINUZ root=$PART_ROOT rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro" | sed -e 's# # #g' | sed -e 's# # #g' >>$DESTDIR/boot/grub/menu.lst
fi fi
echo "initrd $subdir/$KERNELPKG-fallback.img" >>${DESTDIR}/boot/grub/menu.lst echo "initrd $subdir/$KERNELPKG-fallback.img" >>$DESTDIR/boot/grub/menu.lst
NUMBER=$(($NUMBER+1)) NUMBER=$(($NUMBER+1))
done done
### TODO: ### TODO:
# Is it possible to detect a windows installation? # Is it possible to detect a windows installation?
echo "" >>${DESTDIR}/boot/grub/menu.lst echo "" >>$DESTDIR/boot/grub/menu.lst
echo "# ($NUMBER) Windows" >>${DESTDIR}/boot/grub/menu.lst echo "# ($NUMBER) Windows" >>$DESTDIR/boot/grub/menu.lst
echo "#title Windows" >>${DESTDIR}/boot/grub/menu.lst echo "#title Windows" >>$DESTDIR/boot/grub/menu.lst
echo "#rootnoverify (hd0,0)" >>${DESTDIR}/boot/grub/menu.lst echo "#rootnoverify (hd0,0)" >>$DESTDIR/boot/grub/menu.lst
echo "#makeactive" >>${DESTDIR}/boot/grub/menu.lst echo "#makeactive" >>$DESTDIR/boot/grub/menu.lst
echo "#chainloader +1" >>${DESTDIR}/boot/grub/menu.lst echo "#chainloader +1" >>$DESTDIR/boot/grub/menu.lst
fi fi
fi fi
DIALOG --msgbox "Before installing GRUB, you must review the configuration file. You will now be put into the editor. After you save your changes and exit the editor, you can install GRUB." 0 0 DIALOG --msgbox "Before installing GRUB, you must review the configuration file. You will now be put into the editor. After you save your changes and exit the editor, you can install GRUB." 0 0
geteditor || return 1 geteditor || return 1
$EDITOR ${DESTDIR}/boot/grub/menu.lst $EDITOR $DESTDIR/boot/grub/menu.lst
DEVS="$(findbootloaderdisks _)" DEVS="$(findbootloaderdisks _)"
DEVS="$DEVS $(findbootloaderpartitions _)" DEVS="$DEVS $(findbootloaderpartitions _)"
@ -3559,7 +3559,7 @@ dogrub() {
DIALOG --menu "Select the boot device where the GRUB bootloader will be installed (usually the MBR and not a partition)." 14 55 7 $DEVS 2>$ANSWER || return 1 DIALOG --menu "Select the boot device where the GRUB bootloader will be installed (usually the MBR and not a partition)." 14 55 7 $DEVS 2>$ANSWER || return 1
ROOTDEV=$(cat $ANSWER) ROOTDEV=$(cat $ANSWER)
DIALOG --infobox "Installing the GRUB bootloader..." 0 0 DIALOG --infobox "Installing the GRUB bootloader..." 0 0
cp -a ${DESTDIR}/usr/lib/grub/i386-pc/* ${DESTDIR}/boot/grub/ cp -a $DESTDIR/usr/lib/grub/i386-pc/* $DESTDIR/boot/grub/
# freeze xfs filesystems to enable grub installation on xfs filesystems # freeze xfs filesystems to enable grub installation on xfs filesystems
freeze_xfs freeze_xfs
bootpart=$bootdev bootpart=$bootdev
@ -3579,7 +3579,7 @@ dogrub() {
get_chs get_chs
### HACK:we need a dmraid hack here! http://bugs.gentoo.org/show_bug.cgi?id=275566 ### HACK:we need a dmraid hack here! http://bugs.gentoo.org/show_bug.cgi?id=275566
grub_dmraid_hack grub_dmraid_hack
${DESTDIR}/sbin/grub --device-map=/tmp/dev.map --no-floppy --batch >>/tmp/grub.log 2>&1 <<EOF $DESTDIR/sbin/grub --device-map=/tmp/dev.map --no-floppy --batch >>/tmp/grub.log 2>&1 <<EOF
geometry $realdev $CYLINDERS $HEADS $SECTORS geometry $realdev $CYLINDERS $HEADS $SECTORS
root $bootpart root $bootpart
setup $bootdev setup $bootdev
@ -3593,7 +3593,7 @@ EOF
return 1 return 1
fi fi
# copy device map file # copy device map file
cp -f /tmp/dev.map ${DESTDIR}/boot/grub/device.map cp -f /tmp/dev.map $DESTDIR/boot/grub/device.map
DIALOG --msgbox "GRUB was successfully installed." 0 0 DIALOG --msgbox "GRUB was successfully installed." 0 0
S_GRUB=1 S_GRUB=1
if [[ "$(blkid -c /dev/null | grep TYPE=\"linux_raid_member\")" ]]; then if [[ "$(blkid -c /dev/null | grep TYPE=\"linux_raid_member\")" ]]; then
@ -3612,8 +3612,8 @@ dogrub2_common_before() {
# grub2 restriction due to messy dmraid mapping # grub2 restriction due to messy dmraid mapping
# - Encryption is not supported by grub2 yet! # - Encryption is not supported by grub2 yet!
# - raid with no supperblock 0.90 is not supported by grub2 yet! # - raid with no supperblock 0.90 is not supported by grub2 yet!
if [[ -f ${DESTDIR}/boot/grub/menu.lst ]]; then if [[ -f $DESTDIR/boot/grub/menu.lst ]]; then
DIALOG --msgbox "Found ${DESTDIR}/boot/grub/menu.lst, deinstalling grub now ..." 0 0 DIALOG --msgbox "Found $DESTDIR/boot/grub/menu.lst, deinstalling grub now ..." 0 0
$PACMAN -R grub > $LOG $PACMAN -R grub > $LOG
fi fi
bootdev="" bootdev=""
@ -3629,9 +3629,9 @@ dogrub2_common_before() {
dogrub2_config() { dogrub2_config() {
cp ${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg /tmp/.grub.cfg cp $DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg /tmp/.grub.cfg
# remove the default entries by truncating the file at our little tag (set default) # remove the default entries by truncating the file at our little tag (set default)
head -n $(cat /tmp/.grub.cfg | grep -n 'set default' | cut -d: -f 1) /tmp/.grub.cfg >${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg head -n $(cat /tmp/.grub.cfg | grep -n 'set default' | cut -d: -f 1) /tmp/.grub.cfg >$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
rm -f /tmp/.grub.cfg rm -f /tmp/.grub.cfg
# keep the file from being completely bogus # keep the file from being completely bogus
# if [[ "$grubdev" = "DEVICE NOT FOUND" ]]; then # if [[ "$grubdev" = "DEVICE NOT FOUND" ]]; then
@ -3640,7 +3640,7 @@ dogrub2_config() {
# fi # fi
NUMBER=0 NUMBER=0
cat << EOF >> ${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg cat << EOF >> $DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
insmod part_gpt insmod part_gpt
insmod part_msdos insmod part_msdos
@ -3658,7 +3658,7 @@ EOF
if [[ "${GRUB2_EFI}" = "1" ]]; then if [[ "${GRUB2_EFI}" = "1" ]]; then
cat << EOF >> ${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg cat << EOF >> $DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
insmod efi_gop insmod efi_gop
insmod font insmod font
@ -3669,7 +3669,7 @@ EOF
if [[ "${GRUB2_BIOS}" = "1" ]]; then if [[ "${GRUB2_BIOS}" = "1" ]]; then
cat << EOF >> ${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg cat << EOF >> $DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
insmod vbe insmod vbe
insmod font insmod font
@ -3678,7 +3678,7 @@ EOF
fi fi
cat << EOF >> ${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg cat << EOF >> $DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
if loadfont \${prefix}/unicode.pf2 if loadfont \${prefix}/unicode.pf2
then then
@ -3690,54 +3690,54 @@ fi
EOF EOF
echo "" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
sort /tmp/.device-names >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg sort /tmp/.device-names >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
# create default grub entries # create default grub entries
echo "" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
[[ "$USE_RAID" = "1" ]] && echo "insmod raid" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg [[ "$USE_RAID" = "1" ]] && echo "insmod raid" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
! [[ "$RAID_ON_LVM" = "" ]] && echo "insmod lvm" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg ! [[ "$RAID_ON_LVM" = "" ]] && echo "insmod lvm" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "# ($NUMBER) Arch Linux" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "# ($NUMBER) Arch Linux" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "menuentry \"Arch Linux\" {" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "menuentry \"Arch Linux\" {" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
# if [[ "$FAIL_COMPLEX" = "0" ]]; then # if [[ "$FAIL_COMPLEX" = "0" ]]; then
# echo "set root=($grubdev)" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg # echo "set root=($grubdev)" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
# else # else
# echo "set root=$grubdev" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg # echo "set root=$grubdev" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
# fi # fi
[[ "$FAIL_COMPLEX" = "0" ]] && echo "search --fs-uuid --set $complexuuid" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg [[ "$FAIL_COMPLEX" = "0" ]] && echo "search --fs-uuid --set $complexuuid" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then
echo "linux (\${root})/$subdir/$VMLINUZ root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro nomodeset add_efi_memmap" | sed -e 's# # #g' | sed -e 's# # #g' >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "linux (\${root})/$subdir/$VMLINUZ root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro nomodeset add_efi_memmap" | sed -e 's# # #g' | sed -e 's# # #g' >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
else else
echo "linux (\${root})/$subdir/$VMLINUZ root=$PART_ROOT rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro nomodeset add_efi_memmap" | sed -e 's# # #g' | sed -e 's# # #g' >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "linux (\${root})/$subdir/$VMLINUZ root=$PART_ROOT rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro nomodeset add_efi_memmap" | sed -e 's# # #g' | sed -e 's# # #g' >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
fi fi
echo "initrd (\${root})/$subdir/$KERNELPKG.img" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "initrd (\${root})/$subdir/$KERNELPKG.img" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "}" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "}" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
# adding fallback/full image # adding fallback/full image
NUMBER=$(($NUMBER+1)) NUMBER=$(($NUMBER+1))
echo "# ($NUMBER) Arch Linux" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "# ($NUMBER) Arch Linux" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "menuentry \"Arch Linux Fallback\" {" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "menuentry \"Arch Linux Fallback\" {" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
# if [[ "$FAIL_COMPLEX" = "0" ]]; then # if [[ "$FAIL_COMPLEX" = "0" ]]; then
# echo "set root=($grubdev)" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg # echo "set root=($grubdev)" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
# else # else
# echo "set root=$grubdev" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg # echo "set root=$grubdev" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
# fi # fi
[[ "$FAIL_COMPLEX" = "0" ]] && echo "search --fs-uuid --set $complexuuid" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg [[ "$FAIL_COMPLEX" = "0" ]] && echo "search --fs-uuid --set $complexuuid" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then if [[ "$NAME_SCHEME_PARAMETER" = "UUID" || "$NAME_SCHEME_PARAMETER" = "LABEL" ]]; then
echo "linux (\${root})/$subdir/$VMLINUZ root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro nomodeset add_efi_memmap" | sed -e 's# # #g' | sed -e 's# # #g' >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "linux (\${root})/$subdir/$VMLINUZ root=${_rootpart} rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro nomodeset add_efi_memmap" | sed -e 's# # #g' | sed -e 's# # #g' >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
else else
echo "linux (\${root})/$subdir/$VMLINUZ root=$PART_ROOT rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro nomodeset add_efi_memmap" | sed -e 's# # #g' | sed -e 's# # #g' >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "linux (\${root})/$subdir/$VMLINUZ root=$PART_ROOT rootflags=$ROOTFLAGS rootfstype=$ROOTFS $RAIDARRAYS $CRYPTSETUP ro nomodeset add_efi_memmap" | sed -e 's# # #g' | sed -e 's# # #g' >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
fi fi
echo "initrd (\${root})/$subdir/$KERNELPKG-fallback.img" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "initrd (\${root})/$subdir/$KERNELPKG-fallback.img" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "}" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "}" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
### TODO: ### TODO:
# Is it possible to detect a windows installation? # Is it possible to detect a windows installation?
NUMBER=$(($NUMBER+1)) NUMBER=$(($NUMBER+1))
echo "" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "## ($NUMBER) Windows" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "## ($NUMBER) Windows" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "#menuentry \"Windows\" {" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "#menuentry \"Windows\" {" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "#set root=(hd0,3)" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "#set root=(hd0,3)" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "#chainloader +1" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "#chainloader +1" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
echo "#}" >>${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg echo "#}" >>$DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
} }
@ -3754,9 +3754,9 @@ dogrub2_common_after() {
# Edit grub.cfg config file # Edit grub.cfg config file
DIALOG --msgbox "You must now review the grub2 configuration file.\n\nYou will now be put into the editor. After you save your changes and exit the editor, you can install GRUB2." 0 0 DIALOG --msgbox "You must now review the grub2 configuration file.\n\nYou will now be put into the editor. After you save your changes and exit the editor, you can install GRUB2." 0 0
geteditor || return 1 geteditor || return 1
$EDITOR ${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg $EDITOR $DESTDIR/${GRUB2_PREFIX_DIR}/grub.cfg
cp ${DESTDIR}/usr/share/grub/{unicode.pf2,ascii.pf2} ${DESTDIR}/${GRUB2_PREFIX_DIR}/ cp $DESTDIR/usr/share/grub/{unicode.pf2,ascii.pf2} $DESTDIR/${GRUB2_PREFIX_DIR}/
GRUB2_BIOS="" GRUB2_BIOS=""
GRUB2_EFI="" GRUB2_EFI=""
@ -3767,8 +3767,8 @@ dogrub2_bios() {
dogrub2_common_before dogrub2_common_before
if [[ ! -f ${DESTDIR}/boot/grub/grub.cfg ]]; then if [[ ! -f $DESTDIR/boot/grub/grub.cfg ]]; then
DIALOG --msgbox "Couldn't find ${DESTDIR}/boot/grub/grub.cfg, installing grub2-bios now ..." 0 0 DIALOG --msgbox "Couldn't find $DESTDIR/boot/grub/grub.cfg, installing grub2-bios now ..." 0 0
PACKAGES="grub2-bios grub2-common" PACKAGES="grub2-bios grub2-common"
run_pacman run_pacman
# reset PACKAGES after installing # reset PACKAGES after installing
@ -3869,11 +3869,11 @@ dogrub2_bios() {
# freeze and unfreeze xfs filesystems to enable grub2 installation on xfs filesystems # freeze and unfreeze xfs filesystems to enable grub2 installation on xfs filesystems
freeze_xfs freeze_xfs
chroot_mount chroot_mount
chroot ${DESTDIR} /sbin/grub_bios-install --boot-directory=/boot --no-floppy --recheck ${bootdev} >> /tmp/grub2.log chroot $DESTDIR /sbin/grub_bios-install --boot-directory=/boot --no-floppy --recheck ${bootdev} >> /tmp/grub2.log
chroot_umount chroot_umount
cat /tmp/grub2.log >${LOG} cat /tmp/grub2.log >${LOG}
if ! [[ -s /tmp/grub2.log ]] ; then if ! [[ -s /tmp/grub2.log ]] ; then
DIALOG --msgbox "Error installing GRUB2.\n\nProbably you need to install it manually by chrooting into ${DESTDIR}.\nDon't forget to bind /dev and /proc into ${DESTDIR} before chrooting." 0 0 DIALOG --msgbox "Error installing GRUB2.\n\nProbably you need to install it manually by chrooting into $DESTDIR.\nDon't forget to bind /dev and /proc into $DESTDIR before chrooting." 0 0
return 1 return 1
fi fi
DIALOG --msgbox "GRUB2 was successfully installed." 0 0 DIALOG --msgbox "GRUB2 was successfully installed." 0 0
@ -3892,21 +3892,21 @@ dogrub2_efibootmgr() {
EFIBOOTMGR="/usr/sbin/efibootmgr" EFIBOOTMGR="/usr/sbin/efibootmgr"
if [[ -d ${DESTDIR}/sys/firmware/efi/vars ]] if [[ -d $DESTDIR/sys/firmware/efi/vars ]]
then then
# Delete old entries of grub2 - needs to run within chroot - command to be checked # Delete old entries of grub2 - needs to run within chroot - command to be checked
for bootnum in $(chroot ${DESTDIR} ${EFIBOOTMGR} | grep '^Boot[0-9]' | fgrep -i " grub2" | cut -b5-8) for bootnum in $(chroot $DESTDIR ${EFIBOOTMGR} | grep '^Boot[0-9]' | fgrep -i " grub2" | cut -b5-8)
do do
chroot ${DESTDIR} ${EFIBOOTMGR} --bootnum "${bootnum}" --delete-bootnum chroot $DESTDIR ${EFIBOOTMGR} --bootnum "${bootnum}" --delete-bootnum
done done
DISC=$(mount | grep ${DESTDIR}/boot/efi | cut -d' ' -f 1 | sed 's/\(.\{8\}\).*/\1/') DISC=$(mount | grep $DESTDIR/boot/efi | cut -d' ' -f 1 | sed 's/\(.\{8\}\).*/\1/')
[[ "${DISC}" = "" ]] && DISC=$(mount | grep ${DESTDIR}/boot | cut -d' ' -f 1 | sed 's/\(.\{8\}\).*/\1/') [[ "${DISC}" = "" ]] && DISC=$(mount | grep $DESTDIR/boot | cut -d' ' -f 1 | sed 's/\(.\{8\}\).*/\1/')
[[ "${EFISYS_PART}" = "" ]] && EFISYS_PART_NUM=$(sgdisk -p ${DISC} | grep "EF00" | sed 's/\(.\{4\}\).*/\1/' | sed 's/^ *//;s/ *$//') [[ "${EFISYS_PART}" = "" ]] && EFISYS_PART_NUM=$(sgdisk -p ${DISC} | grep "EF00" | sed 's/\(.\{4\}\).*/\1/' | sed 's/^ *//;s/ *$//')
chroot ${DESTDIR} ${EFIBOOTMGR} --create --gpt --disk "${DISC}" --part "${EFISYS_PART_NUM}" --write-signature --label "GRUB2" --loader "\\EFI\\grub\\grub.efi" chroot $DESTDIR ${EFIBOOTMGR} --create --gpt --disk "${DISC}" --part "${EFISYS_PART_NUM}" --write-signature --label "GRUB2" --loader "\\EFI\\grub\\grub.efi"
fi fi
chroot_umount chroot_umount
@ -3923,34 +3923,34 @@ dogrub2_efi_common() {
# reset PACKAGES after installing # reset PACKAGES after installing
PACKAGES="" PACKAGES=""
DISC=$(mount | grep ${DESTDIR}/boot/efi | cut -d' ' -f 1 | sed 's/\(.\{8\}\).*/\1/') DISC=$(mount | grep $DESTDIR/boot/efi | cut -d' ' -f 1 | sed 's/\(.\{8\}\).*/\1/')
if [[ "${DISC}" = "" ]]; then if [[ "${DISC}" = "" ]]; then
DISC=$(mount | grep ${DESTDIR}/boot | cut -d' ' -f 1 | sed 's/\(.\{8\}\).*/\1/') DISC=$(mount | grep $DESTDIR/boot | cut -d' ' -f 1 | sed 's/\(.\{8\}\).*/\1/')
EFISYS="" EFISYS=""
fi fi
parted_gpt parted_gpt
if [[ -d ${DESTDIR}/boot/efi ]]; then if [[ -d $DESTDIR/boot/efi ]]; then
EFISYS_PART=$(mount | grep ${DESTDIR}/boot/efi | cut -d' ' -f 1) EFISYS_PART=$(mount | grep $DESTDIR/boot/efi | cut -d' ' -f 1)
else else
mkdir -p ${DESTDIR}/boot/efi mkdir -p $DESTDIR/boot/efi
EFISYS_PART="" EFISYS_PART=""
fi fi
if [[ "${EFISYS_PART}" = "" ]]; then if [[ "${EFISYS_PART}" = "" ]]; then
EFISYS_PART_NUM=$(sgdisk -p ${DISC} | grep "EF00" | sed 's/\(.\{4\}\).*/\1/' | sed 's/^ *//;s/ *$//') EFISYS_PART_NUM=$(sgdisk -p ${DISC} | grep "EF00" | sed 's/\(.\{4\}\).*/\1/' | sed 's/^ *//;s/ *$//')
mount -o rw -t vfat ${DISC}${EFISYS_PART_NUM} ${DESTDIR}/boot/efi mount -o rw -t vfat ${DISC}${EFISYS_PART_NUM} $DESTDIR/boot/efi
else else
mount -o rw -t vfat ${EFISYS_PART} ${DESTDIR}/boot/efi mount -o rw -t vfat ${EFISYS_PART} $DESTDIR/boot/efi
fi fi
chroot_mount chroot_mount
chroot ${DESTDIR} /sbin/grub_efi_${EFI_ARCH}-install --boot-directory=/boot/efi/efi --bootloader-id=grub --no-floppy --recheck >> /tmp/grub2_efi.log chroot $DESTDIR /sbin/grub_efi_${EFI_ARCH}-install --boot-directory=/boot/efi/efi --bootloader-id=grub --no-floppy --recheck >> /tmp/grub2_efi.log
chroot ${DESTDIR} /bin/grub-mkimage --directory=/usr/lib/grub/${EFI_ARCH}-efi \ chroot $DESTDIR /bin/grub-mkimage --directory=/usr/lib/grub/${EFI_ARCH}-efi \
--format=${EFI_ARCH}-efi \ --format=${EFI_ARCH}-efi \
--prefix="" \ --prefix="" \
--output=/boot/efi/efi/grub/grub_custom.efi \ --output=/boot/efi/efi/grub/grub_custom.efi \
@ -3968,7 +3968,7 @@ dogrub2_efi_common() {
chroot_umount chroot_umount
cat /tmp/grub2_efi.log > ${LOG} cat /tmp/grub2_efi.log > ${LOG}
if ! [[ -s /tmp/grub2_efi.log ]] ; then if ! [[ -s /tmp/grub2_efi.log ]] ; then
DIALOG --msgbox "Error installing GRUB2.\n\nProbably you need to install it manually by chrooting into ${DESTDIR}.\nDon't forget to bind /dev, /sys and /proc into ${DESTDIR} before chrooting." 0 0 DIALOG --msgbox "Error installing GRUB2.\n\nProbably you need to install it manually by chrooting into $DESTDIR.\nDon't forget to bind /dev, /sys and /proc into $DESTDIR before chrooting." 0 0
return 1 return 1
fi fi
@ -4081,7 +4081,7 @@ run_mkinitcpio()
( \ ( \
touch /tmp/setup-mkinitcpio-running touch /tmp/setup-mkinitcpio-running
echo "Initramfs progress ..." > /tmp/initramfs.log; echo >> /tmp/mkinitcpio.log echo "Initramfs progress ..." > /tmp/initramfs.log; echo >> /tmp/mkinitcpio.log
chroot ${DESTDIR} /sbin/mkinitcpio -p $KERNELPKG >>/tmp/mkinitcpio.log 2>&1 chroot $DESTDIR /sbin/mkinitcpio -p $KERNELPKG >>/tmp/mkinitcpio.log 2>&1
echo >> /tmp/mkinitcpio.log echo >> /tmp/mkinitcpio.log
rm -f /tmp/setup-mkinitcpio-running rm -f /tmp/setup-mkinitcpio-running
) & ) &
@ -4309,11 +4309,11 @@ auto_hwdetect()
# check on ide-legacy boot parameter # check on ide-legacy boot parameter
[[ "$(grep -w ide-legacy /proc/cmdline)" ]] && HWPARAMETER="$HWPARAMETER --ide-legacy" [[ "$(grep -w ide-legacy /proc/cmdline)" ]] && HWPARAMETER="$HWPARAMETER --ide-legacy"
# check on used keymap # check on used keymap
! [[ "$(grep '^KEYMAP="us"' ${DESTDIR}/etc/rc.conf)" ]] && HWPARAMETER="$HWPARAMETER --keymap" ! [[ "$(grep '^KEYMAP="us"' $DESTDIR/etc/rc.conf)" ]] && HWPARAMETER="$HWPARAMETER --keymap"
# check on usb input # check on usb input
[[ "$(grep hid /proc/modules)" ]] && HWPARAMETER="$HWPARAMETER --usbinput" [[ "$(grep hid /proc/modules)" ]] && HWPARAMETER="$HWPARAMETER --usbinput"
# check on framebuffer modules and kms # check on framebuffer modules and kms
if [[ -e ${DESTDIR}/lib/initcpio/hooks/v86d && "$(grep -w uvesafb /proc/cmdline)" ]]; then if [[ -e $DESTDIR/lib/initcpio/hooks/v86d && "$(grep -w uvesafb /proc/cmdline)" ]]; then
FBPARAMETER="--uvesafb" FBPARAMETER="--uvesafb"
HWDETECTFILES="/etc/modprobe.d/uvesafb.conf" HWDETECTFILES="/etc/modprobe.d/uvesafb.conf"
fi fi
@ -4333,19 +4333,19 @@ auto_hwdetect()
if [[ "$(grep nfs /proc/modules)" ]]; then if [[ "$(grep nfs /proc/modules)" ]]; then
DIALOG --defaultno --yesno "Setup detected nfs driver...\nDo you need support for booting from nfs shares?" 0 0 && HWPARAMETER="$HWPARAMETER --nfs" DIALOG --defaultno --yesno "Setup detected nfs driver...\nDo you need support for booting from nfs shares?" 0 0 && HWPARAMETER="$HWPARAMETER --nfs"
fi fi
if [[ -e ${DESTDIR}/lib/initcpio/hooks/dmraid ]]; then if [[ -e $DESTDIR/lib/initcpio/hooks/dmraid ]]; then
if ! [[ "$(dmraid -r | grep ^no )" ]]; then if ! [[ "$(dmraid -r | grep ^no )" ]]; then
HWPARAMETER="$HWPARAMETER --dmraid" HWPARAMETER="$HWPARAMETER --dmraid"
fi fi
fi fi
[[ "$(blkid -c=/dev/null -o value -s TYPE $PART_ROOT)" = "btrfs" ]] && HWPARAMETER="$HWPARAMETER --btrfs" [[ "$(blkid -c=/dev/null -o value -s TYPE $PART_ROOT)" = "btrfs" ]] && HWPARAMETER="$HWPARAMETER --btrfs"
HWDETECTMODULES="$(echo $(hwdetect $FBPARAMETER --hostcontroller --filesystem $HWPARAMETER) | sed -e 's#.*\" ##g')" HWDETECTMODULES="$(echo $(hwdetect $FBPARAMETER --hostcontroller --filesystem $HWPARAMETER) | sed -e 's#.*\" ##g')"
HWDETECTHOOKS="$(hwdetect --rootdevice=$PART_ROOT --hooks-dir=${DESTDIR}/lib/initcpio/install $FBPARAMETER $HWPARAMETER --hooks)" HWDETECTHOOKS="$(hwdetect --rootdevice=$PART_ROOT --hooks-dir=$DESTDIR/lib/initcpio/install $FBPARAMETER $HWPARAMETER --hooks)"
HWDETECTRC="$(echo $(hwdetect --net --sound $HWPARAMETER)| sed -e 's#.*) ##g')" HWDETECTRC="$(echo $(hwdetect --net --sound $HWPARAMETER)| sed -e 's#.*) ##g')"
[[ -n "$HWDETECTMODULES" ]] && sed -i -e "s/^MODULES=.*/$HWDETECTMODULES/g" ${DESTDIR}/etc/mkinitcpio.conf [[ -n "$HWDETECTMODULES" ]] && sed -i -e "s/^MODULES=.*/$HWDETECTMODULES/g" $DESTDIR/etc/mkinitcpio.conf
[[ -n "$HWDETECTHOOKS" ]] && sed -i -e "s/^HOOKS=.*/$HWDETECTHOOKS/g" ${DESTDIR}/etc/mkinitcpio.conf [[ -n "$HWDETECTHOOKS" ]] && sed -i -e "s/^HOOKS=.*/$HWDETECTHOOKS/g" $DESTDIR/etc/mkinitcpio.conf
[[ -n "$HWDETECTFILES" ]] && sed -i -e "s#^FILES=.*#FILES=\"$HWDETECTFILES\"#g" ${DESTDIR}/etc/mkinitcpio.conf [[ -n "$HWDETECTFILES" ]] && sed -i -e "s#^FILES=.*#FILES=\"$HWDETECTFILES\"#g" $DESTDIR/etc/mkinitcpio.conf
[[ -n "$HWDETECTRC" ]] && sed -i -e "s/^MODULES=.*/$HWDETECTRC/g" ${DESTDIR}/etc/rc.conf [[ -n "$HWDETECTRC" ]] && sed -i -e "s/^MODULES=.*/$HWDETECTRC/g" $DESTDIR/etc/rc.conf
fi fi
} }
@ -4354,14 +4354,14 @@ auto_fb()
UVESAFB="" UVESAFB=""
if [[ "$(grep -w ati-kms /proc/cmdline)" || "$(grep -w intel-kms /proc/cmdline)" || "$(grep -w nvidia-kms /proc/cmdline)" ]]; then if [[ "$(grep -w ati-kms /proc/cmdline)" || "$(grep -w intel-kms /proc/cmdline)" || "$(grep -w nvidia-kms /proc/cmdline)" ]]; then
# clean modprobe.conf file from options first # clean modprobe.conf file from options first
sed -i -e '/options/d' ${DESTDIR}/etc/modprobe.d/modprobe.conf sed -i -e '/options/d' $DESTDIR/etc/modprobe.d/modprobe.conf
! [[ "$(grep nouveau ${DESTDIR}/etc/modprobe.d/modprobe.conf)" ]] && grep ^[a-z] /etc/modprobe.d/modprobe.conf >> ${DESTDIR}/etc/modprobe.d/modprobe.conf ! [[ "$(grep nouveau $DESTDIR/etc/modprobe.d/modprobe.conf)" ]] && grep ^[a-z] /etc/modprobe.d/modprobe.conf >> $DESTDIR/etc/modprobe.d/modprobe.conf
! [[ "$(grep i915 ${DESTDIR}/etc/modprobe.d/modprobe.conf)" ]] && grep ^[a-z] /etc/modprobe.d/modprobe.conf >> ${DESTDIR}/etc/modprobe.d/modprobe.conf ! [[ "$(grep i915 $DESTDIR/etc/modprobe.d/modprobe.conf)" ]] && grep ^[a-z] /etc/modprobe.d/modprobe.conf >> $DESTDIR/etc/modprobe.d/modprobe.conf
! [[ "$(grep radeon ${DESTDIR}/etc/modprobe.d/modprobe.conf)" ]] && grep ^[a-z] /etc/modprobe.d/modprobe.conf >> ${DESTDIR}/etc/modprobe.d/modprobe.conf ! [[ "$(grep radeon $DESTDIR/etc/modprobe.d/modprobe.conf)" ]] && grep ^[a-z] /etc/modprobe.d/modprobe.conf >> $DESTDIR/etc/modprobe.d/modprobe.conf
fi fi
if [[ -e ${DESTDIR}/lib/initcpio/hooks/v86d && "$(grep -w uvesafb /proc/cmdline)" ]]; then if [[ -e $DESTDIR/lib/initcpio/hooks/v86d && "$(grep -w uvesafb /proc/cmdline)" ]]; then
UVESAFB="$(grep ^[a-z] /etc/modprobe.d/uvesafb.conf)" UVESAFB="$(grep ^[a-z] /etc/modprobe.d/uvesafb.conf)"
sed -i -e "s#options.*#$UVESAFB#g" ${DESTDIR}/etc/modprobe.d/uvesafb.conf sed -i -e "s#options.*#$UVESAFB#g" $DESTDIR/etc/modprobe.d/uvesafb.conf
fi fi
} }
@ -4369,40 +4369,40 @@ auto_parameters()
{ {
if [[ -s /tmp/.keymap ]]; then if [[ -s /tmp/.keymap ]]; then
DIALOG --infobox "Setting the keymap: $(cat /tmp/.keymap | sed -e 's/\..*//g') in rc.conf ..." 0 0 DIALOG --infobox "Setting the keymap: $(cat /tmp/.keymap | sed -e 's/\..*//g') in rc.conf ..." 0 0
sed -i -e "s/^KEYMAP=.*/KEYMAP=\"$(cat /tmp/.keymap | sed -e 's/\..*//g')\"/g" ${DESTDIR}/etc/rc.conf sed -i -e "s/^KEYMAP=.*/KEYMAP=\"$(cat /tmp/.keymap | sed -e 's/\..*//g')\"/g" $DESTDIR/etc/rc.conf
fi fi
if [[ -s /tmp/.font ]]; then if [[ -s /tmp/.font ]]; then
DIALOG --infobox "Setting the consolefont: $(cat /tmp/.font | sed -e 's/\..*//g') in rc.conf ..." 0 0 DIALOG --infobox "Setting the consolefont: $(cat /tmp/.font | sed -e 's/\..*//g') in rc.conf ..." 0 0
sed -i -e "s/^CONSOLEFONT=.*/CONSOLEFONT=\"$(cat /tmp/.font | sed -e 's/\..*//g')\"/g" ${DESTDIR}/etc/rc.conf sed -i -e "s/^CONSOLEFONT=.*/CONSOLEFONT=\"$(cat /tmp/.font | sed -e 's/\..*//g')\"/g" $DESTDIR/etc/rc.conf
fi fi
if [[ -s /tmp/.hardwareclock ]]; then if [[ -s /tmp/.hardwareclock ]]; then
DIALOG --infobox "Setting the hardwareclock: $(cat /tmp/.hardwareclock | sed -e 's/\..*//g') in rc.conf ..." 0 0 DIALOG --infobox "Setting the hardwareclock: $(cat /tmp/.hardwareclock | sed -e 's/\..*//g') in rc.conf ..." 0 0
sed -i -e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$(cat /tmp/.hardwareclock | sed -e 's/\..*//g')\"/g" ${DESTDIR}/etc/rc.conf sed -i -e "s/^HARDWARECLOCK=.*/HARDWARECLOCK=\"$(cat /tmp/.hardwareclock | sed -e 's/\..*//g')\"/g" $DESTDIR/etc/rc.conf
fi fi
if [[ -s /tmp/.timezone ]]; then if [[ -s /tmp/.timezone ]]; then
DIALOG --infobox "Setting the timezone: $(cat /tmp/.timezone | sed -e 's/\..*//g') in rc.conf ..." 0 0 DIALOG --infobox "Setting the timezone: $(cat /tmp/.timezone | sed -e 's/\..*//g') in rc.conf ..." 0 0
sed -i -e "s#^TIMEZONE=.*#TIMEZONE=\"$(cat /tmp/.timezone | sed -e 's/\..*//g')\"#g" ${DESTDIR}/etc/rc.conf sed -i -e "s#^TIMEZONE=.*#TIMEZONE=\"$(cat /tmp/.timezone | sed -e 's/\..*//g')\"#g" $DESTDIR/etc/rc.conf
fi fi
} }
auto_luks() auto_luks()
{ {
if [[ -e /tmp/.crypttab && "$(grep -v '^#' ${DESTDIR}/etc/crypttab)" = "" ]]; then if [[ -e /tmp/.crypttab && "$(grep -v '^#' $DESTDIR/etc/crypttab)" = "" ]]; then
sed -i -e "/$(basename ${PART_ROOT})/d" /tmp/.crypttab sed -i -e "/$(basename ${PART_ROOT})/d" /tmp/.crypttab
cat /tmp/.crypttab >> ${DESTDIR}/etc/crypttab cat /tmp/.crypttab >> $DESTDIR/etc/crypttab
fi fi
} }
auto_timesetting() auto_timesetting()
{ {
TIMEZONE="" TIMEZONE=""
eval $(grep "^TIMEZONE" ${DESTDIR}/etc/rc.conf) eval $(grep "^TIMEZONE" $DESTDIR/etc/rc.conf)
if [[ "$TIMEZONE" != "" && -e ${DESTDIR}/usr/share/zoneinfo/$TIMEZONE ]]; then if [[ "$TIMEZONE" != "" && -e $DESTDIR/usr/share/zoneinfo/$TIMEZONE ]]; then
cp ${DESTDIR}/usr/share/zoneinfo/$TIMEZONE ${DESTDIR}/etc/localtime cp $DESTDIR/usr/share/zoneinfo/$TIMEZONE $DESTDIR/etc/localtime
cp ${DESTDIR}/usr/share/zoneinfo/$TIMEZONE /etc/localtime cp $DESTDIR/usr/share/zoneinfo/$TIMEZONE /etc/localtime
fi fi
if [[ ! -f ${DESTDIR}/var/lib/hwclock/adjtime ]]; then if [[ ! -f $DESTDIR/var/lib/hwclock/adjtime ]]; then
echo "0.0 0 0.0" > ${DESTDIR}/var/lib/hwclock/adjtime echo "0.0 0 0.0" > $DESTDIR/var/lib/hwclock/adjtime
fi fi
} }
@ -4412,8 +4412,8 @@ auto_ftpmirror()
# add installer-selected mirror to the top of the mirrorlist # add installer-selected mirror to the top of the mirrorlist
if [[ "$MODE" = "ftp" && "${SYNC_URL}" != "" ]]; then if [[ "$MODE" = "ftp" && "${SYNC_URL}" != "" ]]; then
SYNC_URL="${SYNC_URL}" SYNC_URL="${SYNC_URL}"
awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${SYNC_URL}"\n\n\") } 1 " "${DESTDIR}/etc/pacman.d/mirrorlist" > /tmp/inst-mirrorlist awk "BEGIN { printf(\"# Mirror used during installation\nServer = "${SYNC_URL}"\n\n\") } 1 " "$DESTDIR/etc/pacman.d/mirrorlist" > /tmp/inst-mirrorlist
mv /tmp/inst-mirrorlist "${DESTDIR}/etc/pacman.d/mirrorlist" mv /tmp/inst-mirrorlist "$DESTDIR/etc/pacman.d/mirrorlist"
fi fi
} }
@ -4467,27 +4467,27 @@ configure_system()
# (feel free to prove me wrong :)) # (feel free to prove me wrong :))
# we could maybe do this just once after the user is really done here, but then he doesn't get # we could maybe do this just once after the user is really done here, but then he doesn't get
# to see the updated file while being in this menu... # to see the updated file while being in this menu...
HOSTNAME=$(sed -n '/^HOSTNAME/s/HOSTNAME=//p' ${DESTDIR}${FILE} | sed 's/"//g') HOSTNAME=$(sed -n '/^HOSTNAME/s/HOSTNAME=//p' $DESTDIR${FILE} | sed 's/"//g')
if ! [[ "$(grep '127\.0\.0\.1' ${DESTDIR}/etc/hosts | grep -q "$HOSTNAME")" ]]; then if ! [[ "$(grep '127\.0\.0\.1' $DESTDIR/etc/hosts | grep -q "$HOSTNAME")" ]]; then
sed -i "s/127\.0\.0\.1.*/& $HOSTNAME/" ${DESTDIR}/etc/hosts sed -i "s/127\.0\.0\.1.*/& $HOSTNAME/" $DESTDIR/etc/hosts
fi fi
$EDITOR ${DESTDIR}${FILE} $EDITOR $DESTDIR${FILE}
elif [[ "$FILE" = "/etc/mkinitcpio.conf" ]]; then # non-file elif [[ "$FILE" = "/etc/mkinitcpio.conf" ]]; then # non-file
DIALOG --msgbox "The mkinitcpio.conf file controls which modules will be placed into the initramfs for your system's kernel.\n\n- Non US keymap users should add 'keymap' to HOOKS= array\n- USB keyboard users should add 'usbinput' to HOOKS= array\n- If you install under VMWARE add 'BusLogic' to MODULES= array\n- raid, lvm2, encrypt are not enabled by default\n- 2 or more disk controllers, please specify the correct module\n loading order in MODULES= array \n\nMost of you will not need to change anything in this file." 18 70 DIALOG --msgbox "The mkinitcpio.conf file controls which modules will be placed into the initramfs for your system's kernel.\n\n- Non US keymap users should add 'keymap' to HOOKS= array\n- USB keyboard users should add 'usbinput' to HOOKS= array\n- If you install under VMWARE add 'BusLogic' to MODULES= array\n- raid, lvm2, encrypt are not enabled by default\n- 2 or more disk controllers, please specify the correct module\n loading order in MODULES= array \n\nMost of you will not need to change anything in this file." 18 70
HOOK_ERROR="" HOOK_ERROR=""
$EDITOR ${DESTDIR}${FILE} $EDITOR $DESTDIR${FILE}
for i in $(cat ${DESTDIR}/etc/mkinitcpio.conf | grep ^HOOKS | sed -e 's/"//g' -e 's/HOOKS=//g'); do for i in $(cat $DESTDIR/etc/mkinitcpio.conf | grep ^HOOKS | sed -e 's/"//g' -e 's/HOOKS=//g'); do
[[ -e ${DESTDIR}/lib/initcpio/install/$i ]] || HOOK_ERROR=1 [[ -e $DESTDIR/lib/initcpio/install/$i ]] || HOOK_ERROR=1
done done
if [[ "$HOOK_ERROR" = "1" ]]; then if [[ "$HOOK_ERROR" = "1" ]]; then
DIALOG --msgbox "ERROR: Detected error in 'HOOKS=' line, please correct HOOKS= in /etc/mkinitcpio.conf!" 18 70 DIALOG --msgbox "ERROR: Detected error in 'HOOKS=' line, please correct HOOKS= in /etc/mkinitcpio.conf!" 18 70
fi fi
elif [[ "$FILE" = "/etc/locale.gen" ]]; then # non-file elif [[ "$FILE" = "/etc/locale.gen" ]]; then # non-file
# enable glibc locales from rc.conf # enable glibc locales from rc.conf
for i in $(grep "^LOCALE" ${DESTDIR}/etc/rc.conf | sed -e 's/.*="//g' -e's/\..*//g'); do for i in $(grep "^LOCALE" $DESTDIR/etc/rc.conf | sed -e 's/.*="//g' -e's/\..*//g'); do
sed -i -e "s/^#$i/$i/g" ${DESTDIR}/etc/locale.gen sed -i -e "s/^#$i/$i/g" $DESTDIR/etc/locale.gen
done done
$EDITOR ${DESTDIR}${FILE} $EDITOR $DESTDIR${FILE}
elif [[ "$FILE" = "Root-Password" ]]; then # non-file elif [[ "$FILE" = "Root-Password" ]]; then # non-file
PASSWORD="" PASSWORD=""
while [[ "${PASSWORD}" = "" ]]; do while [[ "${PASSWORD}" = "" ]]; do
@ -4504,10 +4504,10 @@ configure_system()
DIALOG --msgbox "Password didn't match, please enter again." 0 0 DIALOG --msgbox "Password didn't match, please enter again." 0 0
fi fi
done done
chroot ${DESTDIR} passwd root < /tmp/.password chroot $DESTDIR passwd root < /tmp/.password
rm /tmp/.password rm /tmp/.password
else #regular file else #regular file
$EDITOR ${DESTDIR}${FILE} $EDITOR $DESTDIR${FILE}
fi fi
done done
if [[ $S_CONFIG -eq 1 ]]; then if [[ $S_CONFIG -eq 1 ]]; then
@ -4518,7 +4518,7 @@ configure_system()
# /etc/initcpio.conf # /etc/initcpio.conf
run_mkinitcpio run_mkinitcpio
# /etc/locale.gen # /etc/locale.gen
chroot ${DESTDIR} locale-gen >/dev/null 2>&1 chroot $DESTDIR locale-gen >/dev/null 2>&1
## END POSTPROCESSING ## ## END POSTPROCESSING ##
NEXTITEM="7" NEXTITEM="7"
fi fi