forked from stevleibelt/arch-linux-live-cd-iso-with-zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_iso.sh
executable file
·54 lines (45 loc) · 1.2 KB
/
run_iso.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
####
# @see:
# https://wiki.archlinux.org/title/Archiso#Test_the_ISO_in_QEMU
#
# @author stev leibelt <[email protected]>
# @since 2022-02-07
####
function _main ()
{
local PATH_TO_THIS_SCRIPT=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)
local PATH_TO_THE_ISO="${1:-${PATH_TO_THIS_SCRIPT}/dynamic_data/out/archlinux-archzfs-linux.iso}"
local WHO_AM_I=$(whoami)
if [[ ${WHO_AM_I} == "roo" ]];
then
local SUDO_COMMAND_PREFIX=""
else
local SUDO_COMMAND_PREFIX="sudo "
fi
if [[ -f "${PATH_TO_THE_ISO}" ]];
then
if [[ ! -d "/usr/share/qemu" ]];
then
echo ":: qemu package is missing, installing it ..."
${SUDO_COMMAND_PREFIX} pacman -S qemu-full
fi
if [[ ! -d "/usr/share/edk2-ovmf" ]];
then
echo ":: edk2-ovmf package is missing, installing it ..."
${SUDO_COMMAND_PREFIX} pacman -S edk2-ovmf
fi
echo ":: Do you want to run it as UEFI? [y|N]"
read RUN_AS_UEFI
if [[ ${RUN_AS_UEFI} == "y" ]];
then
run_archiso -u -i "${PATH_TO_THE_ISO}"
else
run_archiso -b -i "${PATH_TO_THE_ISO}"
fi
else
echo ":: Invalid path provided."
echo " >>${PATH_TO_THE_ISO}<< is not a valid file."
fi
}
_main $@