mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
'added autodetect of install media, removed cd usage in setup'
This commit is contained in:
parent
e2274f38b3
commit
b692c68163
3 changed files with 87 additions and 90 deletions
|
@ -39,7 +39,8 @@ run_hook ()
|
||||||
mv /lib/modules/$(uname -r)/kernel/fs/ntfs/ntfs.ko.old /lib/modules/$(uname -r)/kernel/fs/ntfs/ntfs.ko
|
mv /lib/modules/$(uname -r)/kernel/fs/ntfs/ntfs.ko.old /lib/modules/$(uname -r)/kernel/fs/ntfs/ntfs.ko
|
||||||
if [ "$RETRIGGER_UDEV" = "1" ]; then
|
if [ "$RETRIGGER_UDEV" = "1" ]; then
|
||||||
echo "Retrigger udev uevents ..."
|
echo "Retrigger udev uevents ..."
|
||||||
/etc/start_udev uevents
|
udevadm trigger
|
||||||
|
udevadm settle
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "ARCH_ADDONS USAGE:"
|
echo "ARCH_ADDONS USAGE:"
|
||||||
|
|
|
@ -7,13 +7,13 @@ usage() {
|
||||||
echo "media manually than go through the routines in the setup script."
|
echo "media manually than go through the routines in the setup script."
|
||||||
echo
|
echo
|
||||||
echo "First make sure you have all your filesystems mounted under <destdir>."
|
echo "First make sure you have all your filesystems mounted under <destdir>."
|
||||||
echo "e.g. mount -t iso9660 /dev/sdc or /dev/sr0 (for new naming sheme) /src "
|
echo "e.g. mount -t iso9660 /dev/hdc or /dev/sr0 (for new naming sheme) /src "
|
||||||
echo "Then run this script to install all base packages to <destdir>."
|
echo "Then run this script to install all base packages to <destdir>."
|
||||||
echo
|
echo
|
||||||
if [ -e /usr/bin/wget ]; then
|
if [ -e /usr/bin/wget ]; then
|
||||||
echo "<install_mode> must be either 'ftp' or 'cd'"
|
echo "<install_mode> must be either 'ftp' or 'media'"
|
||||||
else
|
else
|
||||||
echo "<install_mode> must be 'cd'"
|
echo "<install_mode> must be 'media'"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
|
@ -25,7 +25,7 @@ usage() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " quickinst cd /mnt /src/core-$(uname -m)/pkg"
|
echo " quickinst media /mnt /src/core-$(uname -m)/pkg"
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ if [ "$INSTMODE" = "ftp" ]; then
|
||||||
ln -sf $DESTDIR/var/cache/pacman/pkg /var/cache/pacman/pkg >/dev/null 2>&1
|
ln -sf $DESTDIR/var/cache/pacman/pkg /var/cache/pacman/pkg >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$INSTMODE" = "cd" ]; then
|
if [ "$INSTMODE" = "media" ]; then
|
||||||
PKGFILE=/tmp/packages.txt
|
PKGFILE=/tmp/packages.txt
|
||||||
cp $PKGARG/packages.txt /tmp/packages.txt
|
cp $PKGARG/packages.txt /tmp/packages.txt
|
||||||
if [ ! -f $PKGFILE ]; then
|
if [ ! -f $PKGFILE ]; then
|
||||||
|
|
|
@ -78,18 +78,72 @@ chroot_umount()
|
||||||
umount $DESTDIR/dev
|
umount $DESTDIR/dev
|
||||||
}
|
}
|
||||||
|
|
||||||
finddisks() {
|
# Check media on install packages
|
||||||
workdir="$PWD"
|
check_media() {
|
||||||
cd /sys/block
|
! [ "$(cat /proc/mounts | grep /dev/$dev)" ] && mount /dev/$dev $media > /dev/null 2>&1
|
||||||
|
if [ -d $media/core-$(uname -m)/pkg ]; then
|
||||||
|
SET_MEDIA=1
|
||||||
|
break
|
||||||
|
else
|
||||||
|
umount $media > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get cdroms and removable devices
|
||||||
|
get_media() {
|
||||||
|
block=/sys/block
|
||||||
|
media=/src
|
||||||
|
SET_MEDIA=0
|
||||||
|
#unmount media first, we may have leftovers ...
|
||||||
|
umount $media > /dev/null 2>&1
|
||||||
# ide devices
|
# ide devices
|
||||||
for dev in $(ls | egrep '^hd'); do
|
if [ "$SET_MEDIA" = "0" ]; then
|
||||||
|
for dev in $(ls $block | egrep '^hd'); do
|
||||||
|
if [ "$(cat $block/$dev/device/media)" = "cdrom" ]; then
|
||||||
|
check_media
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ "$SET_MEDIA" = "0" ]; then
|
||||||
|
# scsi/sata and other devices
|
||||||
|
for dev in $(ls $block | egrep '^sd|^sr|^scd|^sg'); do
|
||||||
|
if [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
||||||
|
check_media
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ "$SET_MEDIA" = "0" ]; then
|
||||||
|
# usb devices with raw partition
|
||||||
|
for dev in $(ls $block | egrep '^sd'); do
|
||||||
|
if [ "$(cat $block/$dev/device/type)" = "0" -a "$(cat $block/$dev/removable)" = "1" -a ! "$(cat $block/$dev/size)" = "0" ]; then
|
||||||
|
check_media
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#check on manual mounted source
|
||||||
|
manual_media() {
|
||||||
|
if [ "$SET_MEDIA" = "0" ]; then
|
||||||
|
DIALOG --msgbox "No source media was autodetected, please switch to another VC and manually mount the source media under /src. If you manually mount to /src, make sure the packages are available under /src/core-$(uname -m)/pkg.\n\n" 15 55
|
||||||
|
fi
|
||||||
|
if [ ! -d /src/core-$(uname -m)/pkg ]; then
|
||||||
|
DIALOG --msgbox "Package directory /src/core-$(uname -m)/pkg is missing!" 0 0
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
finddisks() {
|
||||||
|
block=/sys/block
|
||||||
|
# ide devices
|
||||||
|
for dev in $(ls $block | egrep '^hd'); do
|
||||||
if [ "$(cat $dev/device/media)" = "disk" ]; then
|
if [ "$(cat $dev/device/media)" = "disk" ]; then
|
||||||
echo "/dev/$dev"
|
echo "/dev/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
#scsi/sata devices
|
#scsi/sata devices
|
||||||
for dev in $(ls | egrep '^sd'); do
|
for dev in $(ls $block | egrep '^sd'); do
|
||||||
if ! [ "$(cat $dev/device/type)" = "5" ]; then
|
if ! [ "$(cat $dev/device/type)" = "5" ]; then
|
||||||
echo "/dev/$dev"
|
echo "/dev/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
|
@ -97,21 +151,18 @@ finddisks() {
|
||||||
done
|
done
|
||||||
# cciss controllers
|
# cciss controllers
|
||||||
if [ -d /dev/cciss ] ; then
|
if [ -d /dev/cciss ] ; then
|
||||||
cd /dev/cciss
|
for dev in $(ls /dev/cciss | egrep -v 'p'); do
|
||||||
for dev in $(ls | egrep -v 'p'); do
|
|
||||||
echo "/dev/cciss/$dev"
|
echo "/dev/cciss/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# Smart 2 controllers
|
# Smart 2 controllers
|
||||||
if [ -d /dev/ida ] ; then
|
if [ -d /dev/ida ] ; then
|
||||||
cd /dev/ida
|
for dev in $(ls /dev/ida | egrep -v 'p'); do
|
||||||
for dev in $(ls | egrep -v 'p'); do
|
|
||||||
echo "/dev/ida/$dev"
|
echo "/dev/ida/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
cd "$workdir"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# getuuid()
|
# getuuid()
|
||||||
|
@ -128,32 +179,11 @@ getuuid()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
findcdroms() {
|
|
||||||
block=/sys/block
|
|
||||||
# ide devices
|
|
||||||
for dev in $(ls $block | egrep '^hd'); do
|
|
||||||
if [ "$(cat $block/$dev/device/media)" = "cdrom" ]; then
|
|
||||||
echo "/dev/$dev $(hdparm -I /dev/$dev | grep Model | sed -e 's/.*Model Number://g' -e 's/ //g')"
|
|
||||||
[ "$1" ] && echo $1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# scsi/sata and other devices
|
|
||||||
for dev in $(ls $block | egrep '^sd|^sr|^scd|^sg'); do
|
|
||||||
if [ "$(cat $block/$dev/device/type)" = "5" ]; then
|
|
||||||
#echo "/dev/$dev"
|
|
||||||
echo "/dev/$dev $(hdparm -I /dev/$dev | grep Model | sed -e 's/.*Model Number://g' -e 's/ //g')"
|
|
||||||
[ "$1" ] && echo $1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
findpartitions() {
|
findpartitions() {
|
||||||
workdir="$PWD"
|
block=/sys/block
|
||||||
for devpath in $(finddisks); do
|
for devpath in $(finddisks); do
|
||||||
disk=$(echo $devpath | sed 's|.*/||')
|
disk=$(echo $devpath | sed 's|.*/||')
|
||||||
cd /sys/block/$disk
|
for part in $(ls $block/$disk*); do
|
||||||
for part in $disk*; do
|
|
||||||
# check if not already assembled to a raid device
|
# check if not already assembled to a raid device
|
||||||
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null </dev/$part | grep "lvm2")" -o "$(sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk##g") 2>/dev/null | grep "5")" ]; then
|
if ! [ "$(cat /proc/mdstat 2>/dev/null | grep $part)" -o "$(fstype 2>/dev/null </dev/$part | grep "lvm2")" -o "$(sfdisk -c /dev/$disk $(echo $part | sed -e "s#$disk##g") 2>/dev/null | grep "5")" ]; then
|
||||||
if [ -d $part ]; then
|
if [ -d $part ]; then
|
||||||
|
@ -177,21 +207,18 @@ findpartitions() {
|
||||||
done
|
done
|
||||||
# inlcude cciss controllers
|
# inlcude cciss controllers
|
||||||
if [ -d /dev/cciss ] ; then
|
if [ -d /dev/cciss ] ; then
|
||||||
cd /dev/cciss
|
for dev in $(ls /dev/cciss | egrep 'p'); do
|
||||||
for dev in $(ls | egrep 'p'); do
|
|
||||||
echo "/dev/cciss/$dev"
|
echo "/dev/cciss/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# inlcude Smart 2 controllers
|
# inlcude Smart 2 controllers
|
||||||
if [ -d /dev/ida ] ; then
|
if [ -d /dev/ida ] ; then
|
||||||
cd /dev/ida
|
for dev in $(ls /dev/ida | egrep 'p'); do
|
||||||
for dev in $(ls | egrep 'p'); do
|
|
||||||
echo "/dev/ida/$dev"
|
echo "/dev/ida/$dev"
|
||||||
[ "$1" ] && echo $1
|
[ "$1" ] && echo $1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
cd "$workdir"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_grub_map() {
|
get_grub_map() {
|
||||||
|
@ -686,22 +713,10 @@ mountpoints() {
|
||||||
|
|
||||||
getsource() {
|
getsource() {
|
||||||
S_SRC=0
|
S_SRC=0
|
||||||
if [ "$MODE" = "cd" ]; then
|
if [ "$MODE" = "media" ]; then
|
||||||
DIALOG --menu "You can either install packages from an Arch Linux CD, or you can switch to another VC and manually mount the source media under /src. If you manually mount to /src, make sure the packages are available under /src/core-$(uname -m)/pkg.\n\n" \
|
get_media
|
||||||
15 55 2 \
|
#last fallback, if autodetection fails!
|
||||||
"CD" "Mount the CD-ROM and install from there" \
|
manual_media
|
||||||
"SRC" "I have manually mounted the source media" 2>$ANSWER || return 1
|
|
||||||
case $(cat $ANSWER) in
|
|
||||||
"CD")
|
|
||||||
select_cdrom
|
|
||||||
;;
|
|
||||||
"SRC")
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
if [ ! -d /src/core-$(uname -m)/pkg ]; then
|
|
||||||
DIALOG --msgbox "Package directory /src/core-$(uname -m)/pkg is missing!" 0 0
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$MODE" = "ftp" ]; then
|
if [ "$MODE" = "ftp" ]; then
|
||||||
|
@ -737,32 +752,13 @@ select_mirror() {
|
||||||
echo "Using mirror: $SYNC_URL" >$LOG
|
echo "Using mirror: $SYNC_URL" >$LOG
|
||||||
}
|
}
|
||||||
|
|
||||||
select_cdrom () {
|
|
||||||
# we may have leftover mounts...
|
|
||||||
umount /src >/dev/null 2>&1
|
|
||||||
CDROMS=$(findcdroms)
|
|
||||||
if [ "$CDROMS" = "" ]; then
|
|
||||||
DIALOG --msgbox "No CD drives were found" 0 0
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
DIALOG --menu "Select the CD drive that contains Arch packages" 14 55 7 $CDROMS 2>$ANSWER || return 1
|
|
||||||
CDROM=$(cat $ANSWER)
|
|
||||||
DIALOG --infobox "Mounting $CDROM" 0 0
|
|
||||||
mount -t iso9660 $CDROM /src >/dev/null 2>&1
|
|
||||||
if [ $? -gt 0 ]; then
|
|
||||||
DIALOG --msgbox "Failed to mount $CDROM" 0 0
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# prepare_pacman()
|
# prepare_pacman()
|
||||||
# configures pacman and syncs for the first time on destination system
|
# configures pacman and syncs for the first time on destination system
|
||||||
#
|
#
|
||||||
# params: none
|
# params: none
|
||||||
# returns: 1 on error
|
# returns: 1 on error
|
||||||
prepare_pacman() {
|
prepare_pacman() {
|
||||||
cd /tmp
|
if [ "$MODE" = "media" ]; then
|
||||||
if [ "$MODE" = "cd" ]; then
|
|
||||||
local serverurl="${FILE_URL}"
|
local serverurl="${FILE_URL}"
|
||||||
elif [ "$MODE" = "ftp" ]; then
|
elif [ "$MODE" = "ftp" ]; then
|
||||||
local serverurl="${SYNC_URL}"
|
local serverurl="${SYNC_URL}"
|
||||||
|
@ -796,8 +792,8 @@ select_packages() {
|
||||||
DIALOG --msgbox "Error:\nYou must select Source first." 0 0
|
DIALOG --msgbox "Error:\nYou must select Source first." 0 0
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
# Archboot setup CD Mode uses packages.txt!
|
# Archboot setup media Mode uses packages.txt!
|
||||||
if [ "$MODE" = "cd" ]; then
|
if [ "$MODE" = "media" ]; then
|
||||||
DIALOG --msgbox "Package selection is split into two stages. First you will select package categories that contain packages you may be interested in. Then you will be presented with a full list of packages in your selected categories, allowing you to fine-tune your selection.\n\nNOTE: It is recommended that you install the BASE category from this setup, SUPPORT contains additional useful packages for networking and filesystems, DEVEL contains software building tools." 18 70
|
DIALOG --msgbox "Package selection is split into two stages. First you will select package categories that contain packages you may be interested in. Then you will be presented with a full list of packages in your selected categories, allowing you to fine-tune your selection.\n\nNOTE: It is recommended that you install the BASE category from this setup, SUPPORT contains additional useful packages for networking and filesystems, DEVEL contains software building tools." 18 70
|
||||||
# set up our install location if necessary and sync up
|
# set up our install location if necessary and sync up
|
||||||
# so we can get package lists
|
# so we can get package lists
|
||||||
|
@ -902,7 +898,7 @@ installpkg() {
|
||||||
DIALOG --msgbox "Error:\nYou must select Source first." 0 0
|
DIALOG --msgbox "Error:\nYou must select Source first." 0 0
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ "$MODE" = "cd" ]; then
|
if [ "$MODE" = "media" ]; then
|
||||||
if [ ! -f /tmp/.pkglist -o "$S_SELECT" != "1" ]; then
|
if [ ! -f /tmp/.pkglist -o "$S_SELECT" != "1" ]; then
|
||||||
DIALOG --msgbox "You must select packages first." 0 0
|
DIALOG --msgbox "You must select packages first." 0 0
|
||||||
return 1
|
return 1
|
||||||
|
@ -918,7 +914,7 @@ installpkg() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DIALOG --msgbox "Package installation will begin now. You can watch the output in the progress window. Please be patient." 0 0
|
DIALOG --msgbox "Package installation will begin now. You can watch the output in the progress window. Please be patient." 0 0
|
||||||
if [ "$MODE" = "cd" ]; then
|
if [ "$MODE" = "media" ]; then
|
||||||
PACKAGES=
|
PACKAGES=
|
||||||
# fix pacman list!
|
# fix pacman list!
|
||||||
sed -i -e 's/-i686//g' -e 's/-x86_64//g' /tmp/.pkglist
|
sed -i -e 's/-i686//g' -e 's/-x86_64//g' /tmp/.pkglist
|
||||||
|
@ -1361,24 +1357,24 @@ select_source()
|
||||||
{
|
{
|
||||||
if ! [ $(which $DLPROG) ]; then
|
if ! [ $(which $DLPROG) ]; then
|
||||||
DIALOG --menu "Please select an installation source" 10 35 3 \
|
DIALOG --menu "Please select an installation source" 10 35 3 \
|
||||||
"1" "CD-ROM or OTHER SOURCE" 2>$ANSWER || return 1
|
"1" "CD-ROM, USBSTICK or OTHER SOURCE" 2>$ANSWER || return 1
|
||||||
else
|
else
|
||||||
DIALOG --menu "Please select an installation source" 10 35 3 \
|
DIALOG --menu "Please select an installation source" 10 35 3 \
|
||||||
"1" "CD-ROM or OTHER SOURCE" \
|
"1" "CD-ROM, USBSTICK or OTHER SOURCE" \
|
||||||
"2" "FTP/HTTP" 2>$ANSWER || return 1
|
"2" "FTP/HTTP" 2>$ANSWER || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $(cat $ANSWER) in
|
case $(cat $ANSWER) in
|
||||||
"1")
|
"1")
|
||||||
MODE="cd"
|
MODE="media"
|
||||||
;;
|
;;
|
||||||
"2")
|
"2")
|
||||||
MODE="ftp"
|
MODE="ftp"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$MODE" = "cd" ]; then
|
if [ "$MODE" = "media" ]; then
|
||||||
TITLE="Arch Linux CDROM or OTHER SOURCE Installation"
|
TITLE="Arch Linux CDROM, USBSTICK or OTHER SOURCE Installation"
|
||||||
getsource
|
getsource
|
||||||
else
|
else
|
||||||
TITLE="Arch Linux FTP/HTTP Installation"
|
TITLE="Arch Linux FTP/HTTP Installation"
|
||||||
|
@ -1741,7 +1737,7 @@ mainmenu() {
|
||||||
"7")
|
"7")
|
||||||
install_bootloader ;;
|
install_bootloader ;;
|
||||||
"8")
|
"8")
|
||||||
if [ "$S_SRC" = "1" -a "$MODE" = "cd" ]; then
|
if [ "$S_SRC" = "1" -a "$MODE" = "media" ]; then
|
||||||
umount /src >/dev/null 2>&1
|
umount /src >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
[ -e /tmp/.setup-running ] && rm /tmp/.setup-running
|
[ -e /tmp/.setup-running ] && rm /tmp/.setup-running
|
||||||
|
|
Loading…
Reference in a new issue