summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rwxr-xr-xbuildlive25
-rw-r--r--distro/arch/isoinfo4
-rw-r--r--distro/centos/7/isoinfo7
-rw-r--r--distro/fedora/29/install.sh2
-rw-r--r--distro/fedora/29/isoinfo8
-rw-r--r--distro/fedora/30/entry2
-rw-r--r--distro/fedora/30/isoinfo8
-rw-r--r--distro/fedora/31/entry2
-rw-r--r--distro/fedora/31/install.sh2
-rw-r--r--distro/fedora/31/isoinfo8
-rw-r--r--distro/fedora/32/entry2
-rw-r--r--distro/fedora/32/install.sh2
-rw-r--r--distro/fedora/32/isoinfo8
-rw-r--r--distro/fedora/36/entry (renamed from distro/fedora/29/entry)2
-rw-r--r--distro/fedora/36/install.sh (renamed from distro/fedora/30/install.sh)2
-rw-r--r--distro/fedora/36/isoinfo8
-rw-r--r--distro/grml/64/entry2
-rw-r--r--distro/grml/64/isoinfo4
-rw-r--r--distro/mint/cinnamon/config2
-rw-r--r--distro/mint/mate/config2
-rw-r--r--distro/mint/sha256sum.txt6
-rw-r--r--distro/mint/xfce/config2
-rw-r--r--distro/ubuntu/22.04/config3
-rw-r--r--distro/ubuntu/22.04/entry2
-rw-r--r--distro/ubuntu/22.04/install.sh2
-rw-r--r--distro/ubuntu/22.04/isoinfo11
-rw-r--r--functions.sh98
28 files changed, 142 insertions, 87 deletions
diff --git a/README.md b/README.md
index 18cbad2..293ac0f 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,8 @@ A presentation in Chinese is at https://wehack.space/vimacs/liveusb-builder.odp.
You need these packages on your GNU/Linux system to use liveusb-builder.
- libarchive: for ISO image extraction
-- udevil: for mounting USB disk partitions
+- udisks2 (optional,recommended): for mounting USB disk partitions without being root
+- udevil (optional): for mounting USB disk partitions and ISO images without being root
- wget: for downloading
- syslinux (recommended): bootloader for legacy BIOS
- GRUB: bootloader for legacy BIOS if there's no syslinux, and bootloader for UEFI
diff --git a/buildlive b/buildlive
index 120c14d..3020410 100755
--- a/buildlive
+++ b/buildlive
@@ -17,18 +17,10 @@ DOWNLOAD_ONLY=0
UMOUNT_BOOT=0
UMOUNT_ROOT=0
CLEAN_USB=0
+BOOTLOADER_ONLY=0
. functions.sh
-msg() {
- echo -e "$1" >&2
-}
-
-fatalerror() {
- msg "\x1b[1;31m$1\x1b[0m"
- exit 1
-}
-
usage() {
>&2 cat << EOF
$0 [--root <path>] [options] [--distro=<metadist> <isofile>] [distro] ...
@@ -39,6 +31,7 @@ options:
--boot <path>
--boot=<path>: set the path to put the kernel and loader files
--clean: clean the old live USB files before installing
+ --bootloader-only: only install the boot loader
--no-grub: do not install GRUB loader (still generate grub.cfg)
--grubcfg: do not do real install, only generate grub.cfg file
--downloadonly: only download the ISO files
@@ -52,7 +45,7 @@ try_mount() {
then
if ! findmnt "$1" > /dev/null
then
- udevil mount "$1" > /dev/null
+ mount_block "$1" > /dev/null
mnt=$(findmnt -n -o TARGET "$1")
else
mnt=$(findmnt -n -o TARGET "$1")
@@ -63,6 +56,9 @@ try_mount() {
echo "$mnt"
}
+detect_block_mount_tool 2>/dev/null
+detect_iso_mount_tool 2>/dev/null
+
unset ISOPATH
CFGFILE="$HOME/.liveusb-builder"
test -f "$CFGFILE" && source "$CFGFILE" || true
@@ -91,6 +87,9 @@ do
--dev=*)
DEVNAME=${1/--dev=}
;;
+ --bootloader-only)
+ BOOTLOADER_ONLY=1
+ ;;
--no-grub)
INSTALL_GRUB=0
;;
@@ -172,7 +171,7 @@ if [[ "$DOWNLOAD_ONLY" == 0 ]]; then
msg "Files will be copy to $ROOTPATH"
fi
-if [[ "${#DISTROLIST[@]}" == 0 ]]; then
+if [[ "$BOOTLOADER_ONLY" == 0 && "${#DISTROLIST[@]}" == 0 ]]; then
usage
exit 1
fi
@@ -263,9 +262,9 @@ fi
if [ "$UMOUNT_BOOT" == 1 ]; then
msg 'Trying to umount the boot mountpoint, you may need to wait for sync() to complete.'
- udevil umount "$BOOTPATH"
+ unmount_block "$BOOTPATH"
fi
if [ "$UMOUNT_ROOT" == 1 -a "$ROOTPATH" != "$BOOTPATH" ]; then
msg 'Trying to umount the root mountpoint, you may need to wait for sync() to complete.'
- udevil umount "$ROOTPATH"
+ unmount_block "$ROOTPATH"
fi
diff --git a/distro/arch/isoinfo b/distro/arch/isoinfo
index 1351cf5..9d51eaf 100644
--- a/distro/arch/isoinfo
+++ b/distro/arch/isoinfo
@@ -1,7 +1,7 @@
-_isodate=2021.07.01
+_isodate=2023.07.01
ISONAME="$DISTRONAME $_isodate"
ISOURL=iso/$_isodate/archlinux-$_isodate-x86_64.iso
-SHA1=5804cefb2e5e7498cb15f38180cb3ebc094f6955
+SHA256=1a2c1cdea0118b60525f55ee616e9cd4cf68fe17db906ce3d8e46fd06f9907eb
mirrorlist=(
https://mirrors.tuna.tsinghua.edu.cn/archlinux
diff --git a/distro/centos/7/isoinfo b/distro/centos/7/isoinfo
index 7cf0f37..a355d5f 100644
--- a/distro/centos/7/isoinfo
+++ b/distro/centos/7/isoinfo
@@ -1,7 +1,8 @@
ISONAME="$DISTRONAME 7 Install DVD"
-ISOURL=7/isos/x86_64/CentOS-7-x86_64-DVD-2003.iso
-SHA256=087a5743dc6fd6706d9b961b8147423ddc029451b938364c760d75440eb7be14
+ISOURL=7/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso
+SHA256=e33d7b1ea7a9e2f38c8f693215dd85254c3a4fe446f93f563279715b68d07987
mirrorlist=(
-https://mirrors.tuna.tsinghua.edu.cn/centos
+https://mirrors.ustc.edu.cn/centos/
+https://mirrors.pku.edu.cn/centos/
)
diff --git a/distro/fedora/29/install.sh b/distro/fedora/29/install.sh
deleted file mode 100644
index 9d7ac8b..0000000
--- a/distro/fedora/29/install.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-version=29
-source distro/fedora/install.sh
diff --git a/distro/fedora/29/isoinfo b/distro/fedora/29/isoinfo
deleted file mode 100644
index 230a362..0000000
--- a/distro/fedora/29/isoinfo
+++ /dev/null
@@ -1,8 +0,0 @@
-ISONAME="$DISTRONAME 29 Workstation"
-ISOURL=releases/29/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-29-1.2.iso
-SHA256=653cc283749100e9b46625d23938ff890ae29482bef142f5a0f99c5a5ddc03e9
-
-mirrorlist=(
-https://mirrors.tuna.tsinghua.edu.cn/fedora
-http://mirrors.ustc.edu.cn/fedora/linux
-)
diff --git a/distro/fedora/30/entry b/distro/fedora/30/entry
deleted file mode 100644
index ee0c632..0000000
--- a/distro/fedora/30/entry
+++ /dev/null
@@ -1,2 +0,0 @@
-version=30
-source distro/fedora/entry.common
diff --git a/distro/fedora/30/isoinfo b/distro/fedora/30/isoinfo
deleted file mode 100644
index 38052f2..0000000
--- a/distro/fedora/30/isoinfo
+++ /dev/null
@@ -1,8 +0,0 @@
-ISONAME="$DISTRONAME 30 Workstation"
-ISOURL=releases/30/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-30-1.2.iso
-SHA256=a4e2c49368860887f1cc1166b0613232d4d5de6b46f29c9756bc7cfd5e13f39f
-
-mirrorlist=(
-https://mirrors.tuna.tsinghua.edu.cn/fedora
-http://mirrors.ustc.edu.cn/fedora/linux
-)
diff --git a/distro/fedora/31/entry b/distro/fedora/31/entry
deleted file mode 100644
index 21743bf..0000000
--- a/distro/fedora/31/entry
+++ /dev/null
@@ -1,2 +0,0 @@
-version=31
-source distro/fedora/entry.common
diff --git a/distro/fedora/31/install.sh b/distro/fedora/31/install.sh
deleted file mode 100644
index 220ce4a..0000000
--- a/distro/fedora/31/install.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-version=31
-source distro/fedora/install.sh
diff --git a/distro/fedora/31/isoinfo b/distro/fedora/31/isoinfo
deleted file mode 100644
index cc62989..0000000
--- a/distro/fedora/31/isoinfo
+++ /dev/null
@@ -1,8 +0,0 @@
-ISONAME="$DISTRONAME 31 Workstation"
-ISOURL=releases/31/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-31-1.9.iso
-SHA256=1d73ce30bfb96274c53b09013ea23320f0f64a1b0c663217110a5baf0b2c6528
-
-mirrorlist=(
-https://mirrors.tuna.tsinghua.edu.cn/fedora
-http://mirrors.ustc.edu.cn/fedora/linux
-)
diff --git a/distro/fedora/32/entry b/distro/fedora/32/entry
deleted file mode 100644
index a894f89..0000000
--- a/distro/fedora/32/entry
+++ /dev/null
@@ -1,2 +0,0 @@
-version=32
-source distro/fedora/entry.common
diff --git a/distro/fedora/32/install.sh b/distro/fedora/32/install.sh
deleted file mode 100644
index 823da66..0000000
--- a/distro/fedora/32/install.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-version=32
-source distro/fedora/install.sh
diff --git a/distro/fedora/32/isoinfo b/distro/fedora/32/isoinfo
deleted file mode 100644
index f03e4bb..0000000
--- a/distro/fedora/32/isoinfo
+++ /dev/null
@@ -1,8 +0,0 @@
-ISONAME="$DISTRONAME 32 Workstation"
-ISOURL=releases/32/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-32-1.6.iso
-SHA256=4d0f6653e2e0860c99ffe0ef274a46d875fb85bd2a40cb896dce1ed013566924
-
-mirrorlist=(
-https://mirrors.tuna.tsinghua.edu.cn/fedora
-http://mirrors.ustc.edu.cn/fedora/linux
-)
diff --git a/distro/fedora/29/entry b/distro/fedora/36/entry
index 0837ba5..2bafd81 100644
--- a/distro/fedora/29/entry
+++ b/distro/fedora/36/entry
@@ -1,2 +1,2 @@
-version=29
+version=36
source distro/fedora/entry.common
diff --git a/distro/fedora/30/install.sh b/distro/fedora/36/install.sh
index 02157f5..76f025c 100644
--- a/distro/fedora/30/install.sh
+++ b/distro/fedora/36/install.sh
@@ -1,2 +1,2 @@
-version=30
+version=36
source distro/fedora/install.sh
diff --git a/distro/fedora/36/isoinfo b/distro/fedora/36/isoinfo
new file mode 100644
index 0000000..d7b9190
--- /dev/null
+++ b/distro/fedora/36/isoinfo
@@ -0,0 +1,8 @@
+ISONAME="$DISTRONAME 36 Workstation"
+ISOURL=releases/36/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-36-1.5.iso
+SHA256=80169891cb10c679cdc31dc035dab9aae3e874395adc5229f0fe5cfcc111cc8c
+
+mirrorlist=(
+https://mirrors.tuna.tsinghua.edu.cn/fedora
+http://mirrors.ustc.edu.cn/fedora/linux
+)
diff --git a/distro/grml/64/entry b/distro/grml/64/entry
index 6da9264..63c6345 100644
--- a/distro/grml/64/entry
+++ b/distro/grml/64/entry
@@ -1,4 +1,4 @@
-ver=2020.06
+ver=2022.11
TITLE="Grml $ver 64-bit full"
KERNEL=/liveusb-kernel/grml/64/vmlinuz
INITRD=/liveusb-kernel/grml/64/initrd.img
diff --git a/distro/grml/64/isoinfo b/distro/grml/64/isoinfo
index e7c0665..10eb917 100644
--- a/distro/grml/64/isoinfo
+++ b/distro/grml/64/isoinfo
@@ -1,7 +1,7 @@
-ver=2020.06
+ver=2022.11
ISONAME="Grml $ver 64-bit full"
ISOURL="grml64-full_$ver.iso"
-SHA256=a6d8f82f020e33e13ddf71978234a4168506b1dd89c91ce4ebc13ef86025039f
+SHA256=8b8e4a548a7dcdcd8f3e93098e740c012b5427cf5f4bc5730ef428a6feddd877
mirrorlist=(
http://download.grml.org
diff --git a/distro/mint/cinnamon/config b/distro/mint/cinnamon/config
index 757ec71..7173c31 100644
--- a/distro/mint/cinnamon/config
+++ b/distro/mint/cinnamon/config
@@ -1,3 +1,3 @@
_arch=x86_64
-_ver=20.1
+_ver=21.1
_de=Cinnamon
diff --git a/distro/mint/mate/config b/distro/mint/mate/config
index 15e3460..8f601df 100644
--- a/distro/mint/mate/config
+++ b/distro/mint/mate/config
@@ -1,3 +1,3 @@
_arch=x86_64
-_ver=20.1
+_ver=21.1
_de=MATE
diff --git a/distro/mint/sha256sum.txt b/distro/mint/sha256sum.txt
index 37ed80e..3149122 100644
--- a/distro/mint/sha256sum.txt
+++ b/distro/mint/sha256sum.txt
@@ -1,3 +1,3 @@
-14f73c93f75e873f4ac70b6cddc83703755c2421135a8fbbfd6ccfeed107e971 *linuxmint-20.1-cinnamon-64bit.iso
-12ccfa2494acf761b2f5a3379ed770495d97051c3944571d5ad5e7c50d11c975 *linuxmint-20.1-mate-64bit.iso
-4f9cc6fa8a2d6fd7ffdf88478812ff994e36470ecfe50761f7efd56e6d3d7018 *linuxmint-20.1-xfce-64bit.iso
+2df322f030d8ff4633360930a92d78829d10e515d2f6975b9bdfd1c0de769aca *linuxmint-21.1-cinnamon-64bit.iso
+f7fb9c0500e583c46587402578547ea56125e0a054097f9f464a2500830c8b25 *linuxmint-21.1-mate-64bit.iso
+6fea221b5b0272d55de57f3d31498cdf76682f414e60d28131dc428e719efa8b *linuxmint-21.1-xfce-64bit.iso
diff --git a/distro/mint/xfce/config b/distro/mint/xfce/config
index 5dc8373..68ad3ce 100644
--- a/distro/mint/xfce/config
+++ b/distro/mint/xfce/config
@@ -1,3 +1,3 @@
_arch=x86_64
-_ver=20.1
+_ver=21.1
_de=Xfce
diff --git a/distro/ubuntu/22.04/config b/distro/ubuntu/22.04/config
new file mode 100644
index 0000000..05d6f4b
--- /dev/null
+++ b/distro/ubuntu/22.04/config
@@ -0,0 +1,3 @@
+_ver=22.04.2
+VMLINUZ=vmlinuz
+INITRD=initrd
diff --git a/distro/ubuntu/22.04/entry b/distro/ubuntu/22.04/entry
new file mode 100644
index 0000000..aaa6cb7
--- /dev/null
+++ b/distro/ubuntu/22.04/entry
@@ -0,0 +1,2 @@
+source distro/ubuntu/22.04/config
+source distro/ubuntu/entry
diff --git a/distro/ubuntu/22.04/install.sh b/distro/ubuntu/22.04/install.sh
new file mode 100644
index 0000000..88496fc
--- /dev/null
+++ b/distro/ubuntu/22.04/install.sh
@@ -0,0 +1,2 @@
+source distro/ubuntu/22.04/config
+source distro/ubuntu/install.sh
diff --git a/distro/ubuntu/22.04/isoinfo b/distro/ubuntu/22.04/isoinfo
new file mode 100644
index 0000000..5e3f0db
--- /dev/null
+++ b/distro/ubuntu/22.04/isoinfo
@@ -0,0 +1,11 @@
+source distro/ubuntu/22.04/config
+
+ISONAME="$DISTRONAME ${_ver} amd64"
+ISOURL="${_ver}/ubuntu-${_ver}-desktop-amd64.iso"
+SHA256=b98dac940a82b110e6265ca78d1320f1f7103861e922aa1a54e4202686e9bbd3
+
+mirrorlist=(
+http://releases.ubuntu.com
+http://mirrors.ustc.edu.cn/ubuntu-releases
+https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases
+)
diff --git a/functions.sh b/functions.sh
index 8f9db5f..b967388 100644
--- a/functions.sh
+++ b/functions.sh
@@ -1,6 +1,26 @@
# Copyright (C) 2016-2018 Iru Cai <mytbk920423@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
+msg() {
+ echo -e "$1" >&2
+}
+
+fatalerror() {
+ msg "\x1b[1;31m$1\x1b[0m"
+ exit 1
+}
+
+as-root() {
+ echo as-root "$*"
+ if [ "$UID" == 0 ]; then
+ "$@"
+ elif type -p sudo > /dev/null; then
+ sudo "$@"
+ elif type -p su > /dev/null; then
+ su -c "$*"
+ fi
+}
+
checksum_verify() {
local _hashtool _hashsum _cksum
if [ -n "$SHA512" ]; then
@@ -194,6 +214,69 @@ get_iso_label() {
file -b "$1" | cut -d\' -f2
}
+# We try to a proper mount tool to mount block devices and iso files,
+# if we cannot find it, use the system mount tool.
+# Both udisks2 and udevil can mount block devices, but only udevil
+# can mount iso files.
+detect_block_mount_tool() {
+ if (udisksctl status | grep DEVICE > /dev/null); then
+ BLOCKMOUNT=udisks2
+ elif (udevil | grep 'udevil version' > /dev/null); then
+ BLOCKMOUNT=udevil
+ else
+ BLOCKMOUNT=system
+ fi
+}
+
+detect_iso_mount_tool() {
+ if (udevil | grep 'udevil version' > /dev/null); then
+ ISOMOUNT=udevil
+ else
+ ISOMOUNT=system
+ fi
+}
+
+udevil_mount() {
+ udevil mount "$1"
+}
+
+udevil_unmount() {
+ udevil umount "$1"
+}
+
+udisks2_mount() {
+ udisksctl mount -b "$1"
+}
+
+udisks2_unmount() {
+ local mnt_source
+ mnt_source="$(findmnt -n -o SOURCE "$1")"
+ udisksctl unmount -b "${mnt_source}"
+}
+
+system_mount() {
+ local mountpoint
+ local uid
+ mountpoint="$(mktemp -d)"
+ uid="$(id -u)"
+ # first try uid= option of mount(1)
+ if ! as-root mount -o "uid=$uid" "$1" "$mountpoint" 2> /dev/null; then
+ as-root mount "$1" "$mountpoint"
+ fi
+}
+
+system_unmount() {
+ as-root umount "$1"
+}
+
+mount_block() {
+ ${BLOCKMOUNT}_mount "$1"
+}
+
+unmount_block() {
+ ${BLOCKMOUNT}_unmount "$1"
+}
+
mount_iso() {
LOOPDEV=$(/sbin/losetup -n -O NAME -j "${ISO_FILEPATH}")
if [[ -n "$LOOPDEV" ]]
@@ -202,7 +285,7 @@ mount_iso() {
umount_iso
fi
- udevil mount "${ISO_FILEPATH}"
+ ${ISOMOUNT}_mount "${ISO_FILEPATH}"
LOOPDEV=$(/sbin/losetup -n -O NAME -j "${ISO_FILEPATH}")
if [[ -n "$LOOPDEV" ]]
then
@@ -211,7 +294,7 @@ mount_iso() {
}
umount_iso() {
- udevil umount "$ISOMNT"
+ ${ISOMOUNT}_unmount "$ISOMNT"
}
# iso_extract: extract files from iso image to destination path
@@ -247,17 +330,6 @@ getdiskbypart() {
done
}
-as-root() {
- echo as-root "$*"
- if [ "$UID" == 0 ]; then
- "$@"
- elif type -p sudo > /dev/null; then
- sudo "$@"
- elif type -p su > /dev/null; then
- su -c "$*"
- fi
-}
-
syslinux_header() {
cat << EOF
UI menu.c32