mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
transition dialog with progressbar
This commit is contained in:
parent
2e47905666
commit
98d20e906b
2 changed files with 24 additions and 12 deletions
|
@ -39,9 +39,9 @@ _download_latest
|
||||||
echo -e "\e[1mInformation:\e[m Logging is done on \e[1m/dev/tty7\e[m..."
|
echo -e "\e[1mInformation:\e[m Logging is done on \e[1m/dev/tty7\e[m..."
|
||||||
# Generate new environment and launch it with kexec
|
# Generate new environment and launch it with kexec
|
||||||
if [[ -n "${_L_COMPLETE}" || -n "${_L_INSTALL_COMPLETE}" ]]; then
|
if [[ -n "${_L_COMPLETE}" || -n "${_L_INSTALL_COMPLETE}" ]]; then
|
||||||
_TITLE="Archboot $(uname -m) | Basic Setup | Generating New Environment"
|
_TITLE="Archboot $(uname -m) | Basic Setup | New Environment"
|
||||||
_KEEP="Logging is done on ${_LOG}."
|
_KEEP="Logging to ${_LOG}."
|
||||||
_new_environment | _dialog --title "Initializing..." --gauge "${_KEEP} Waiting for pacman..." 6 75 0
|
_new_environment | _dialog --title "Initializing..." --gauge "${_KEEP} Waiting for pacman..." 6 75 0 | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>/dev/null
|
||||||
fi
|
fi
|
||||||
# Generate new images
|
# Generate new images
|
||||||
if [[ -n "${_G_RELEASE}" ]]; then
|
if [[ -n "${_G_RELEASE}" ]]; then
|
||||||
|
|
|
@ -22,6 +22,20 @@ _local_mode () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_dialog() {
|
||||||
|
dialog --backtitle "${_TITLE}" "$@"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
_progress() {
|
||||||
|
cat <<EOF
|
||||||
|
XXX
|
||||||
|
${1}
|
||||||
|
${2}
|
||||||
|
XXX
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
# use -o discard for RAM cleaning on delete
|
# use -o discard for RAM cleaning on delete
|
||||||
# (online fstrimming the block device!)
|
# (online fstrimming the block device!)
|
||||||
# fstrim <mountpoint> for manual action
|
# fstrim <mountpoint> for manual action
|
||||||
|
@ -31,25 +45,23 @@ _switch_root_zram() {
|
||||||
TTY=${TTY#/dev/}
|
TTY=${TTY#/dev/}
|
||||||
if [[ "${TTY}" = "tty1" ]]; then
|
if [[ "${TTY}" = "tty1" ]]; then
|
||||||
clear
|
clear
|
||||||
echo -e "\e[1mInitializing\e[m \e[96mArchboot\e[m \e[1m- Arch Linux Environment:\e[m"
|
|
||||||
echo -e "\e[1mStep 1/4:\e[m Creating /dev/zram0 with zstd compression..."
|
|
||||||
[[ -d /sysroot ]] || mkdir /sysroot
|
[[ -d /sysroot ]] || mkdir /sysroot
|
||||||
modprobe zram &>/dev/null
|
modprobe zram &>/dev/null
|
||||||
modprobe zstd &>/dev/null
|
modprobe zstd &>/dev/null
|
||||||
echo "1" >/sys/block/zram0/reset
|
echo "1" >/sys/block/zram0/reset
|
||||||
echo "zstd" >/sys/block/zram0/comp_algorithm
|
echo "zstd" >/sys/block/zram0/comp_algorithm
|
||||||
echo "4G" >/sys/block/zram0/disksize
|
echo "4G" >/sys/block/zram0/disksize
|
||||||
echo -e "\e[1mStep 2/4:\e[m Creating btrfs on /dev/zram0..."
|
_progress "33" "Creating btrfs on /dev/zram0..."
|
||||||
mkfs.btrfs /dev/zram0 &>/dev/null
|
mkfs.btrfs /dev/zram0 &>/dev/null
|
||||||
mount -o discard /dev/zram0 /sysroot &>/dev/null
|
mount -o discard /dev/zram0 /sysroot &>/dev/null
|
||||||
echo -e "\e[1mStep 3/4:\e[m Removing firmware and modules..."
|
_progress "66" "Removing firmware and modules..."
|
||||||
# cleanup firmware and modules
|
# cleanup firmware and modules
|
||||||
mv /lib/firmware/regulatory* /tmp/
|
mv /lib/firmware/regulatory* /tmp/
|
||||||
rm -rf /lib/firmware/*
|
rm -rf /lib/firmware/*
|
||||||
mv /tmp/regulatory* /lib/firmware/
|
mv /tmp/regulatory* /lib/firmware/
|
||||||
rm -rf /lib/modules/*/kernel/drivers/{acpi,ata,gpu,bcma,block,bluetooth,hid,input,platform,net,scsi,soc,spi,usb,video}
|
rm -rf /lib/modules/*/kernel/drivers/{acpi,ata,gpu,bcma,block,bluetooth,hid,input,platform,net,scsi,soc,spi,usb,video}
|
||||||
rm -rf /lib/modules/*/extramodules
|
rm -rf /lib/modules/*/extramodules
|
||||||
echo -e "\e[1mStep 4/4:\e[m Copying archboot rootfs to /sysroot..."
|
_progress "75" "Copying archboot rootfs to /sysroot..."
|
||||||
tar -C / --exclude="./dev/*" --exclude="./proc/*" --exclude="./sys/*" \
|
tar -C / --exclude="./dev/*" --exclude="./proc/*" --exclude="./sys/*" \
|
||||||
--exclude="./run/*" --exclude="./mnt/*" --exclude="./tmp/*" --exclude="./sysroot/*" \
|
--exclude="./run/*" --exclude="./mnt/*" --exclude="./tmp/*" --exclude="./sysroot/*" \
|
||||||
-clpf - . | tar -C /sysroot -xlspf - &>/dev/null
|
-clpf - . | tar -C /sysroot -xlspf - &>/dev/null
|
||||||
|
@ -58,9 +70,8 @@ if [[ "${TTY}" = "tty1" ]]; then
|
||||||
rm -f /sysroot/{VERSION,config,buildconfig,init} &>/dev/null
|
rm -f /sysroot/{VERSION,config,buildconfig,init} &>/dev/null
|
||||||
# systemd needs this for root_switch
|
# systemd needs this for root_switch
|
||||||
touch /etc/initrd-release
|
touch /etc/initrd-release
|
||||||
echo -e "\e[1;96mArchboot\e[m \e[1m- Arch Linux Environment finished.\e[m"
|
_progress "100" "Systemd initrd-switch-root will be launched in a second..."
|
||||||
echo -e "\e[1mSystemd initrd-switch-root will be launched in a second...\e[m"
|
read -r -t 2
|
||||||
read -r -t 3
|
|
||||||
# https://www.freedesktop.org/software/systemd/man/bootup.html
|
# https://www.freedesktop.org/software/systemd/man/bootup.html
|
||||||
# enable systemd initrd functionality
|
# enable systemd initrd functionality
|
||||||
touch /etc/initrd-release
|
touch /etc/initrd-release
|
||||||
|
@ -164,7 +175,8 @@ if ! [[ -e /.clean-pacman-db ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! mount | grep -q zram0; then
|
if ! mount | grep -q zram0; then
|
||||||
_switch_root_zram | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>/dev/null
|
_TITLE="Archboot $(uname -m) | Basic Setup | Moving to ZRAM"
|
||||||
|
_switch_root_zram | _dialog --title "Initializing..." --gauge "Creating /dev/zram0 with zstd compression..." 6 75 0 | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>/dev/null
|
||||||
else
|
else
|
||||||
systemctl start systemd-networkd
|
systemctl start systemd-networkd
|
||||||
systemctl start systemd-resolved
|
systemctl start systemd-resolved
|
||||||
|
|
Loading…
Reference in a new issue