230 lines
7.7 KiB
Diff
230 lines
7.7 KiB
Diff
From b53d472be37994ec39a7f37e3f817bf5f4f9154a Mon Sep 17 00:00:00 2001
|
|
From: xhaa123 <xhaa123@outlook.com>
|
|
Date: Tue, 29 Oct 2024 12:28:58 +0800
|
|
Subject: [PATCH] Modify Arch Install Scripts to work with Future Linux Install
|
|
Scripts
|
|
|
|
---
|
|
Makefile | 12 +++++-----
|
|
README.md | 6 +++--
|
|
common | 23 +++++++++----------
|
|
.../bash/{arch-chroot => future-chroot} | 4 ++--
|
|
.../zsh/{_arch-chroot => _future-chroot} | 2 +-
|
|
...ot.8.asciidoc => future-chroot.8.asciidoc} | 10 ++++----
|
|
arch-chroot.in => future-chroot.in | 8 +++----
|
|
7 files changed, 33 insertions(+), 32 deletions(-)
|
|
rename completion/bash/{arch-chroot => future-chroot} (88%)
|
|
rename completion/zsh/{_arch-chroot => _future-chroot} (97%)
|
|
rename doc/{arch-chroot.8.asciidoc => future-chroot.8.asciidoc} (80%)
|
|
rename arch-chroot.in => future-chroot.in (94%)
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index d2928a5..7026b3a 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -1,14 +1,14 @@
|
|
VER=26
|
|
|
|
-PREFIX = /usr/local
|
|
+PREFIX = /usr
|
|
|
|
BINPROGS = \
|
|
- arch-chroot \
|
|
+ future-chroot \
|
|
genfstab \
|
|
pacstrap
|
|
|
|
MANS = \
|
|
- doc/arch-chroot.8 \
|
|
+ doc/future-chroot.8 \
|
|
doc/genfstab.8 \
|
|
doc/pacstrap.8
|
|
|
|
@@ -25,7 +25,7 @@ _v_GEN_0 = @echo " GEN " $@;
|
|
|
|
edit = $(V_GEN) m4 -P $@.in >$@ && chmod go-w,+x $@
|
|
|
|
-arch-chroot: arch-chroot.in common
|
|
+future-chroot: future-chroot.in common
|
|
$(edit)
|
|
|
|
genfstab: genfstab.in fstab-helpers
|
|
@@ -49,8 +49,8 @@ shellcheck: $(BINPROGS)
|
|
shellcheck -W 99 --color -x test/test_*
|
|
|
|
install: all
|
|
- install -d $(DESTDIR)$(PREFIX)/bin
|
|
- install -m 0755 $(BINPROGS) $(DESTDIR)$(PREFIX)/bin
|
|
+ install -d $(DESTDIR)$(PREFIX)/sbin
|
|
+ install -m 0755 $(BINPROGS) $(DESTDIR)$(PREFIX)/sbin
|
|
install -d $(DESTDIR)$(PREFIX)/share/zsh/site-functions
|
|
install -m 0644 $(ZSHCOMP) $(DESTDIR)$(PREFIX)/share/zsh/site-functions
|
|
install -d $(DESTDIR)$(PREFIX)/share/bash-completion/completions
|
|
diff --git a/README.md b/README.md
|
|
index 348db42..6198a36 100644
|
|
--- a/README.md
|
|
+++ b/README.md
|
|
@@ -1,7 +1,9 @@
|
|
-# Arch Install Scripts
|
|
+# Modify Arch Install Scripts
|
|
+
|
|
+# Future Install Scripts
|
|
|
|
This is a small suite of scripts aimed at automating some menial
|
|
-tasks when installing [Arch Linux](https://www.archlinux.org).
|
|
+tasks when installing [Future Linux](https://www.futurelinux.xyz).
|
|
|
|
## Requirements
|
|
|
|
diff --git a/common b/common
|
|
index ced125b..53c17cc 100644
|
|
--- a/common
|
|
+++ b/common
|
|
@@ -29,15 +29,15 @@ chroot_setup() {
|
|
[[ $(trap -p EXIT) ]] && die '(BUG): attempting to overwrite existing EXIT trap'
|
|
trap 'chroot_teardown' EXIT
|
|
|
|
- chroot_add_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
|
|
- chroot_add_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
|
|
+ chroot_add_mount --bind /dev "$1/dev" &&
|
|
+ chroot_add_mount devpts "$1/dev/pts" -t devpts -o gid=5,mode=0620 &&
|
|
+ chroot_add_mount proc $1/proc -t proc &&
|
|
+ chroot_add_mount sysfs $1/sys -t sysfs &&
|
|
+ chroot_add_mount tmpfs "$1/run" -t tmpfs &&
|
|
+ chroot_add_mount tmpfs "$1/dev/shm" -t tmpfs -o nosuid,nodev &&
|
|
ignore_error chroot_maybe_add_mount "[[ -d '$1/sys/firmware/efi/efivars' ]]" \
|
|
- efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs -o nosuid,noexec,nodev &&
|
|
- chroot_add_mount udev "$1/dev" -t devtmpfs -o mode=0755,nosuid &&
|
|
- chroot_add_mount devpts "$1/dev/pts" -t devpts -o mode=0620,gid=5,nosuid,noexec &&
|
|
- chroot_add_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
|
|
- chroot_add_mount /run "$1/run" --bind --make-private &&
|
|
- chroot_add_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
|
|
+ efivarfs "$1/sys/firmware/efi/efivars" -t efivarfs
|
|
+
|
|
}
|
|
|
|
chroot_teardown() {
|
|
@@ -68,8 +68,8 @@ unshare_setup() {
|
|
trap 'unshare_teardown' EXIT
|
|
|
|
chroot_add_mount_lazy "$1" "$1" --bind &&
|
|
- chroot_add_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
|
|
- chroot_add_mount_lazy /sys "$1/sys" --rbind &&
|
|
+ chroot_add_mount proc "$1/proc" -t proc &&
|
|
+ chroot_add_mount sysfs "$1/sys" -t sysfs &&
|
|
chroot_add_link /proc/self/fd "$1/dev/fd" &&
|
|
chroot_add_link /proc/self/fd/0 "$1/dev/stdin" &&
|
|
chroot_add_link /proc/self/fd/1 "$1/dev/stdout" &&
|
|
@@ -80,8 +80,7 @@ unshare_setup() {
|
|
chroot_bind_device /dev/tty "$1/dev/tty" &&
|
|
chroot_bind_device /dev/urandom "$1/dev/urandom" &&
|
|
chroot_bind_device /dev/zero "$1/dev/zero" &&
|
|
- chroot_add_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
|
|
- chroot_add_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
|
|
+ chroot_add_mount tmpfs "$1/run" -t tmpfs
|
|
}
|
|
|
|
unshare_teardown() {
|
|
diff --git a/completion/bash/arch-chroot b/completion/bash/future-chroot
|
|
similarity index 88%
|
|
rename from completion/bash/arch-chroot
|
|
rename to completion/bash/future-chroot
|
|
index de53d92..c42c004 100644
|
|
--- a/completion/bash/arch-chroot
|
|
+++ b/completion/bash/future-chroot
|
|
@@ -1,4 +1,4 @@
|
|
-_arch_chroot() {
|
|
+_future_chroot() {
|
|
compopt +o dirnames
|
|
local cur prev opts i
|
|
_init_completion -n : || return
|
|
@@ -22,4 +22,4 @@ _arch_chroot() {
|
|
compopt -o dirnames
|
|
}
|
|
|
|
-complete -F _arch_chroot arch-chroot
|
|
+complete -F _future_chroot future-chroot
|
|
diff --git a/completion/zsh/_arch-chroot b/completion/zsh/_future-chroot
|
|
similarity index 97%
|
|
rename from completion/zsh/_arch-chroot
|
|
rename to completion/zsh/_future-chroot
|
|
index 6229af8..985264a 100644
|
|
--- a/completion/zsh/_arch-chroot
|
|
+++ b/completion/zsh/_future-chroot
|
|
@@ -1,4 +1,4 @@
|
|
-#compdef arch-chroot
|
|
+#compdef future-chroot
|
|
|
|
# NOTE: nearly everything here is borrowed from the chroot completion
|
|
local -a args=(
|
|
diff --git a/doc/arch-chroot.8.asciidoc b/doc/future-chroot.8.asciidoc
|
|
similarity index 80%
|
|
rename from doc/arch-chroot.8.asciidoc
|
|
rename to doc/future-chroot.8.asciidoc
|
|
index 5f3f27c..e708639 100644
|
|
--- a/doc/arch-chroot.8.asciidoc
|
|
+++ b/doc/future-chroot.8.asciidoc
|
|
@@ -1,21 +1,21 @@
|
|
-arch-chroot(8)
|
|
+future-chroot(8)
|
|
==============
|
|
|
|
Name
|
|
----
|
|
-arch-chroot - enhanced chroot command
|
|
+future-chroot - enhanced chroot command
|
|
|
|
Synopsis
|
|
--------
|
|
-arch-chroot [options] chroot-dir [command] [arguments...]
|
|
+future-chroot [options] chroot-dir [command] [arguments...]
|
|
|
|
Description
|
|
-----------
|
|
-arch-chroot wraps the linkman:chroot[1] command while ensuring that important
|
|
+future-chroot wraps the linkman:chroot[1] command while ensuring that important
|
|
functionality is available, e.g. mounting '/dev/', '/proc' and other API
|
|
filesystems, or exposing linkman:resolv.conf[5] to the chroot.
|
|
|
|
-If 'command' is unspecified, arch-chroot will launch */bin/bash*.
|
|
+If 'command' is unspecified, future-chroot will launch */bin/bash*.
|
|
|
|
[NOTE]
|
|
======
|
|
diff --git a/arch-chroot.in b/future-chroot.in
|
|
similarity index 94%
|
|
rename from arch-chroot.in
|
|
rename to future-chroot.in
|
|
index 0868a2a..001531d 100644
|
|
--- a/arch-chroot.in
|
|
+++ b/future-chroot.in
|
|
@@ -19,7 +19,7 @@ usage: ${0##*/} chroot-dir [command] [arguments...]
|
|
|
|
If 'command' is unspecified, ${0##*/} will launch /bin/bash.
|
|
|
|
-Note that when using arch-chroot, the target chroot directory *should* be a
|
|
+Note that when using future-chroot, the target chroot directory *should* be a
|
|
mountpoint. This ensures that tools such as pacman(8) or findmnt(8) have an
|
|
accurate hierarchy of the mounted filesystems within the chroot.
|
|
|
|
@@ -65,7 +65,7 @@ chroot_add_resolv_conf() {
|
|
chroot_add_mount "$src" "$dest" -c --bind
|
|
}
|
|
|
|
-arch-chroot() {
|
|
+future-chroot() {
|
|
(( EUID == 0 )) || die 'This script must be run with root privileges'
|
|
|
|
[[ -d $chrootdir ]] || die "Can't create chroot on non-directory %s" "$chrootdir"
|
|
@@ -117,8 +117,8 @@ shift
|
|
args=("$@")
|
|
if (( unshare )); then
|
|
setup=unshare_setup
|
|
- $mount_unshare bash -c "$(declare_all); arch-chroot"
|
|
+ $mount_unshare bash -c "$(declare_all); future-chroot"
|
|
else
|
|
setup=chroot_setup
|
|
- arch-chroot
|
|
+ future-chroot
|
|
fi
|