Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9074ab676 | ||
|
|
5118eae42c | ||
| 845c24cf10 |
13
PKGBUILD
13
PKGBUILD
@@ -4,7 +4,7 @@
|
|||||||
_pkgname="calamares"
|
_pkgname="calamares"
|
||||||
pkgname="$_pkgname"
|
pkgname="$_pkgname"
|
||||||
pkgver=3.4.2
|
pkgver=3.4.2
|
||||||
pkgrel=1
|
pkgrel=5
|
||||||
pkgdesc="Distribution-independent installer framework"
|
pkgdesc="Distribution-independent installer framework"
|
||||||
url="https://codeberg.org/Calamares/calamares"
|
url="https://codeberg.org/Calamares/calamares"
|
||||||
license=("GPL-3.0-or-later")
|
license=("GPL-3.0-or-later")
|
||||||
@@ -27,8 +27,15 @@ makedepends=(
|
|||||||
|
|
||||||
_pkgsrc="$_pkgname"
|
_pkgsrc="$_pkgname"
|
||||||
_pkgext="tar.gz"
|
_pkgext="tar.gz"
|
||||||
source=("calamares.zip")
|
source=("calamares.zip"
|
||||||
sha256sums=('9d59a1e630f7ee99b9668b8356f8ab0fe152092ca2d4f01e4c86d79819b414b8')
|
"calamares_polkit"
|
||||||
|
"49-nopasswd-calamares.rules"
|
||||||
|
"calamares.desktop")
|
||||||
|
|
||||||
|
sha256sums=('d3c0e93e4103f602598eba446a1712f373c4feb83950aee4a283e7395232dc21'
|
||||||
|
'b7f932912d33cfa188c0d06a25fb144ae6e0c69636ce90ed0a04ed2df0ae6ef3'
|
||||||
|
'56d85ff6bf860b9559b8c9f997ad9b1002f3fccc782073760eca505e3bddd176'
|
||||||
|
'c9f38c31882f506306a771028ee70b5cc5b8c81eca3e252502151055a43a5e6c')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
local _skip_modules=(
|
local _skip_modules=(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Comment[da]=Installer styresystemet på disk
|
|||||||
Comment[de]=Manjaro Linux installieren
|
Comment[de]=Manjaro Linux installieren
|
||||||
Exec=/usr/bin/calamares_polkit %f
|
Exec=/usr/bin/calamares_polkit %f
|
||||||
Icon=calamares
|
Icon=calamares
|
||||||
Terminal=false
|
Terminal=true
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Qt;System;
|
Categories=Qt;System;
|
||||||
|
|||||||
@@ -639,12 +639,7 @@ def run_grub_install(fw_type, partitions, efi_directory, install_hybrid_grub):
|
|||||||
"--force"])
|
"--force"])
|
||||||
else:
|
else:
|
||||||
|
|
||||||
libcalamares.utils.debug("run_grub_install------else bios 1")
|
if libcalamares.globalstorage.value("bootLoader") is None and install_hybrid_grub:
|
||||||
if efi_directory is not None and not install_hybrid_grub:
|
|
||||||
libcalamares.utils.warning(_("Cannot install BIOS bootloader on UEFI installation when install_hybrid_grub is 'False'!"))
|
|
||||||
|
|
||||||
|
|
||||||
if libcalamares.globalstorage.value("bootLoader") is None:
|
|
||||||
efi_install_path = libcalamares.globalstorage.value("efiSystemPartition")
|
efi_install_path = libcalamares.globalstorage.value("efiSystemPartition")
|
||||||
if efi_install_path is None or efi_install_path == "":
|
if efi_install_path is None or efi_install_path == "":
|
||||||
efi_install_path = "/boot/efi"
|
efi_install_path = "/boot/efi"
|
||||||
@@ -655,7 +650,6 @@ def run_grub_install(fw_type, partitions, efi_directory, install_hybrid_grub):
|
|||||||
return
|
return
|
||||||
boot_loader_install_path = "/dev/" + boot_loader_install_path.split("\n")[1]
|
boot_loader_install_path = "/dev/" + boot_loader_install_path.split("\n")[1]
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.debug("run_grub_install------else bios 1-1 ")
|
|
||||||
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
||||||
boot_loader_install_path = boot_loader["installPath"]
|
boot_loader_install_path = boot_loader["installPath"]
|
||||||
libcalamares.utils.debug(f"boot_loader_install_path: {boot_loader_install_path}")
|
libcalamares.utils.debug(f"boot_loader_install_path: {boot_loader_install_path}")
|
||||||
@@ -666,7 +660,6 @@ def run_grub_install(fw_type, partitions, efi_directory, install_hybrid_grub):
|
|||||||
# boot_loader_install_path points to the physical disk to install GRUB
|
# boot_loader_install_path points to the physical disk to install GRUB
|
||||||
# to. It should start with "/dev/", and be at least as long as the
|
# to. It should start with "/dev/", and be at least as long as the
|
||||||
# string "/dev/sda".
|
# string "/dev/sda".
|
||||||
libcalamares.utils.debug("run_grub_install------else bios 2")
|
|
||||||
if not boot_loader_install_path.startswith("/dev/") or len(boot_loader_install_path) < 8:
|
if not boot_loader_install_path.startswith("/dev/") or len(boot_loader_install_path) < 8:
|
||||||
raise ValueError(f"boot_loader_install_path contains unexpected value '{boot_loader_install_path}'")
|
raise ValueError(f"boot_loader_install_path contains unexpected value '{boot_loader_install_path}'")
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,65 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ $(which pkexec) ]; then
|
|
||||||
sudo "/usr/bin/calamares" "$@" "-d"
|
# 函数:检查网络连接
|
||||||
|
# 尝试ping Google DNS,-c 1 只发送一个包,-W 2 超时2秒
|
||||||
|
has_internet() {
|
||||||
|
ping -c 1 -W 2 8.8.8.8 > /dev/null 2>&1
|
||||||
|
return $? # 返回ping的退出状态码 (0表示成功)
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "正在检查网络连接..."
|
||||||
|
|
||||||
|
NETWORK_STATUS="offline" # 初始状态为离线
|
||||||
|
|
||||||
|
if has_internet; then
|
||||||
|
NETWORK_STATUS="online"
|
||||||
|
echo "网络已连接。"
|
||||||
else
|
else
|
||||||
/usr/bin/calamares "$@" "-d"
|
echo "未检测到网络连接,将尝试等待最多30秒..."
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
echo "等待网络... ($i/30秒)"
|
||||||
|
if has_internet; then
|
||||||
|
NETWORK_STATUS="online"
|
||||||
|
echo "网络已连接。"
|
||||||
|
break # 成功连接,跳出循环
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$NETWORK_STATUS" == "offline" ]; then
|
||||||
|
echo "在30秒内未能检测到网络连接。"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 如果网络在线,尝试更新 Calamares
|
||||||
|
if [ "$NETWORK_STATUS" == "online" ]; then
|
||||||
|
echo "网络在线,尝试更新 Calamares..."
|
||||||
|
# 检查 pacman 是否存在,虽然在 Arch 系系统中通常都有
|
||||||
|
if command -v pacman &> /dev/null; then
|
||||||
|
if sudo pacman -Sy --noconfirm tms-calamares-config; then
|
||||||
|
echo "Calamares 更新成功或已是最新版本。"
|
||||||
|
else
|
||||||
|
echo "Calamares 更新失败。可能会使用旧版本启动。"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "未找到 pacman 包管理器,无法更新 Calamares。"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "网络离线,跳过 Calamares 更新。"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 启动 Calamares
|
||||||
|
echo "启动 Calamares 安装程序..."
|
||||||
|
|
||||||
|
# 原始的 Calamares 启动逻辑
|
||||||
|
if [ $(which pkexec) ]; then
|
||||||
|
# 如果 pkexec 存在,通过 sudo 运行 calamares
|
||||||
|
# 注意:这里沿用您原脚本的写法,即检查 pkexec 但仍使用 sudo。
|
||||||
|
# 如果您希望通过 pkexec 提升权限,应改为 pkexec "/usr/bin/calamares" "$@" "-d"
|
||||||
|
sudo "/usr/bin/calamares" "$@" "-d"
|
||||||
|
else
|
||||||
|
# 否则,直接运行 calamares
|
||||||
|
/usr/bin/calamares "$@" "-d"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Calamares 启动命令已执行。"
|
||||||
|
|||||||
Reference in New Issue
Block a user