split usr.zram to only use on xfce launch

This commit is contained in:
Tobias Powalowski 2022-05-17 11:36:31 +02:00
parent 652629b8c5
commit b52ba55f16
2 changed files with 16 additions and 14 deletions

View file

@ -23,13 +23,12 @@ done
_archboot_check _archboot_check
_download_latest _download_latest
echo -e "\033[1mInformation:\033[0m Logging is done on \033[1m/dev/tty7\033[0m ..." echo -e "\033[1mInformation:\033[0m Logging is done on \033[1m/dev/tty7\033[0m ..."
_zram_initialize
# Generate new environment and launch it with kexec # Generate new environment and launch it with kexec
if [[ "${_L_COMPLETE}" == "1" || "${_L_INSTALL_COMPLETE}" == "1" ]]; then if [[ "${_L_COMPLETE}" == "1" || "${_L_INSTALL_COMPLETE}" == "1" ]]; then
_update_installer_check _update_installer_check
touch /.update-installer touch /.update-installer
_umount_w_dir _umount_w_dir
_zram_mount "${_ZRAM_USR}"
_zram_w_dir "${_ZRAM_SIZE}" _zram_w_dir "${_ZRAM_SIZE}"
echo -e "\033[1mStep 1/9:\033[0m Waiting for gpg pacman keyring import to finish ..." echo -e "\033[1mStep 1/9:\033[0m Waiting for gpg pacman keyring import to finish ..."
_gpg_check _gpg_check
@ -71,7 +70,6 @@ fi
# Generate new images # Generate new images
if [[ "${_G_RELEASE}" == "1" ]]; then if [[ "${_G_RELEASE}" == "1" ]]; then
_ZRAM_IMAGE_SIZE=${_ZRAM_IMAGE_SIZE:-"5G"} _ZRAM_IMAGE_SIZE=${_ZRAM_IMAGE_SIZE:-"5G"}
_zram_mount "${_ZRAM_USR}"
_zram_w_dir "${_ZRAM_IMAGE_SIZE}" _zram_w_dir "${_ZRAM_IMAGE_SIZE}"
echo -e "\033[1mStep 1/2:\033[0m Removing not necessary files from / ..." echo -e "\033[1mStep 1/2:\033[0m Removing not necessary files from / ..."
_clean_archboot _clean_archboot
@ -84,15 +82,16 @@ fi
# Launch xfce # Launch xfce
if [[ "${_L_XFCE}" == "1" ]]; then if [[ "${_L_XFCE}" == "1" ]]; then
if ! [[ -e /usr/bin/startxfce4 ]]; then if ! [[ -e /usr/bin/startxfce4 ]]; then
_zram_mount "${_ZRAM_USR}" echo -e "\033[1mStep 1/5:\033[0m Move /usr to /usr.zram ..."
echo -e "\033[1mStep 1/4:\033[0m Waiting for gpg pacman keyring import to finish ..." _zram_usr "${_ZRAM_USR}"
echo -e "\033[1mStep 2/5:\033[0m Waiting for gpg pacman keyring import to finish ..."
_gpg_check _gpg_check
echo -e "\033[1mStep 2/4:\033[0m Installing XFCE desktop now ..." echo -e "\033[1mStep 3/5:\033[0m Installing XFCE desktop now ..."
echo " This will need some time ..." echo " This will need some time ..."
_prepare_xfce >/dev/tty7 2>&1 _prepare_xfce >/dev/tty7 2>&1
echo -e "\033[1mStep 3/4:\033[0m Configuring XFCE desktop ..." echo -e "\033[1mStep 4/5:\033[0m Configuring XFCE desktop ..."
_configure_xfce >/dev/tty7 2>&1 _configure_xfce >/dev/tty7 2>&1
echo -e "\033[1mStep 4/4:\033[0m Starting avahi-daemon ..." echo -e "\033[1mStep 5/5:\033[0m Starting avahi-daemon ..."
systemctl start avahi-daemon.service systemctl start avahi-daemon.service
fi fi
echo "Setting VNC password /etc/tigervnc/passwd to ${_VNC_PW} ..." echo "Setting VNC password /etc/tigervnc/passwd to ${_VNC_PW} ..."

View file

@ -85,16 +85,20 @@ _update_installer_check() {
fi fi
} }
# use -o discard for RAM cleaning on delete _zram_initialize() {
# (online fstrimming the block device!)
# fstrim <mountpoint> for manual action
# it needs some seconds to get RAM free on delete!
_zram_mount() {
if ! mountpoint -q /usr; then
# add defaults # add defaults
_ZRAM_ALGORITHM=${_ZRAM_ALGORITHM:-"zstd"} _ZRAM_ALGORITHM=${_ZRAM_ALGORITHM:-"zstd"}
modprobe zram num_devices=2> /dev/tty7 2>&1 modprobe zram num_devices=2> /dev/tty7 2>&1
echo "${_ZRAM_ALGORITHM}" >/sys/block/zram0/comp_algorithm echo "${_ZRAM_ALGORITHM}" >/sys/block/zram0/comp_algorithm
echo "${_ZRAM_ALGORITHM}" >/sys/block/zram1/comp_algorithm
}
# use -o discard for RAM cleaning on delete
# (online fstrimming the block device!)
# fstrim <mountpoint> for manual action
# it needs some seconds to get RAM free on delete!
_zram_usr() {
if ! mountpoint -q /usr; then
echo "${1}" >/sys/block/zram0/disksize echo "${1}" >/sys/block/zram0/disksize
echo "Creating btrfs filesystem with ${1} on /dev/zram0 ..." > /dev/tty7 echo "Creating btrfs filesystem with ${1} on /dev/zram0 ..." > /dev/tty7
mkfs.btrfs -q --mixed /dev/zram0 > /dev/tty7 2>&1 mkfs.btrfs -q --mixed /dev/zram0 > /dev/tty7 2>&1
@ -116,7 +120,6 @@ _zram_mount() {
} }
_zram_w_dir() { _zram_w_dir() {
echo "${_ZRAM_ALGORITHM}" >/sys/block/zram1/comp_algorithm
echo "${1}" >/sys/block/zram1/disksize echo "${1}" >/sys/block/zram1/disksize
echo "Creating btrfs filesystem with ${1} on /dev/zram1 ..." > /dev/tty7 echo "Creating btrfs filesystem with ${1} on /dev/zram1 ..." > /dev/tty7
mkfs.btrfs -q --mixed /dev/zram1 > /dev/tty7 2>&1 mkfs.btrfs -q --mixed /dev/zram1 > /dev/tty7 2>&1