Update 'debian.sh'

This commit is contained in:
verita84 2022-12-09 16:49:37 +00:00
parent e9d4d9ee12
commit 593832c228

View File

@ -2,9 +2,13 @@
########################
# INSTRUCTIONS
# For new disk installs, initialize the disk to setup Encryption and partitions:
# ./debian.sh initialize nvme0n1
# ./debian.sh initialize nvme0n1 (DO NOT SPECIFY /dev/ !)
#
# Before running the install, change the User and Passwords in this file
# Before running the install, ensure that you have Internet access. If you modify the
# WIRELESS_PASSWORD and SSID in this file, you can connect to the Internet with:
# ./debian.sh wifi
#
# Plesae be sure to change USER,USER_PASSWORD,DISK_PASSWORD, and ROOT_PASSWORD strings in this file
#
# To install/reinstall the OS:
# ./debian.sh install nvme0n1
@ -26,13 +30,14 @@ BOOT="/dev/$(lsblk | grep $HARD_DISK | head -3 | tail -1 | cut -c 7-20 | cut -d
ROOT_NAME='debian'
USB_BACKUP='/dev/disk/by-uuid/1a143f83-d4fe-4894-8e67-2b6d3baacea6'
######################################
USER="verita84"
USER="123456"
USER_PASSWORD="123456"
ROOT_PASSWORD="123456"
WIRELESS_PASSWORD='123456'
SSID='123456'
WIRELESS_INTERFACE='wlan0'
DISK_PASSWORD='123456'
COMPRESSION='compress=zlib:9'
FLATPAKS+=( app/net.brinkervii.grapejuice app/org.gnome.Photos app/org.mozilla.firefox org.gnome.Evolution app/com.vscodium.codium app/org.libreoffice.LibreOffice org.gajim.Gajim org.gajim.Gajim.Plugin.omemo org.telegram.desktop app/im.riot.Riot app/io.mpv.Mpv app/org.gimp.GIMP fr.handbrake.ghb org.kde.kdenlive )
@ -142,7 +147,7 @@ install() {
custom_service_files
services
btrfs-tweaks
hosts
cpuPower
setup_script "$1"
unmount
}
@ -221,13 +226,6 @@ bootloader() {
rm -f $TARGET/setup.sh
}
function cpuPower() {
#CPU POWERSAVE AND ACPI Events
echo "governor='powersave'" >>$TARGET/etc/default/cpupower
echo "min_freq='400MHz'" >>$TARGET/etc/default/cpupower
echo "max_freq='2GHz'" >>$TARGET/etc/default/cpupower
}
btrfs_filesytem() {
btrfs sub create $TARGET/@$ROOT_NAME
btrfs sub create $TARGET/@.snapshots
@ -240,7 +238,7 @@ btrfs_filesytem() {
echo "Binding BTRFS Root"
echo
umount $TARGET
mount -o subvol=@$ROOT_NAME /dev/mapper/root $TARGET
mount -o $COMPRESSION,subvol=@$ROOT_NAME /dev/mapper/root $TARGET
}
mounts() {
@ -301,15 +299,15 @@ fstab() {
mkdir $TARGET/etc
echo "UUID=$(/sbin/blkid | grep ${BOOT} | cut -d '"' -f2) /boot ext4 defaults 0 1" >$TARGET/etc/fstab
echo "UUID=$(/sbin/blkid | grep ${EFI} | cut -d '"' -f4) /boot/efi vfat umask=0077 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root / btrfs noatime,nodiratime,autodefrag,compress,subvol=@$ROOT_NAME 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /.snapshots btrfs noatime,nodiratime,autodefrag,compress,subvol=@.snapshots 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /var/lib/libvirt btrfs noatime,nodiratime,autodefrag,compress,subvol=@libvirt 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root / btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@$ROOT_NAME 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /.snapshots btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@.snapshots 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /var/lib/libvirt btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@libvirt 0 1" >>$TARGET/etc/fstab
echo "tmpfs /var/log tmpfs defaults 0 0" >>$TARGET/etc/fstab
echo "tmpfs /var/cache/pacman/pkg tmpfs defaults 0 0" >>$TARGET/etc/fstab
echo "/dev/mapper/root /home btrfs noatime,nodiratime,autodefrag,compress,subvol=@home 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /root btrfs noatime,nodiratime,autodefrag,compress,subvol=@root 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /var/lib/postgres btrfs noatime,nodiratime,autodefrag,compress,subvol=@postgres 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /var/lib/containers btrfs noatime,nodiratime,autodefrag,compress,subvol=@containers 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /home btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@home 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /root btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@root 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /var/lib/postgresql btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@postgres 0 1" >>$TARGET/etc/fstab
echo "/dev/mapper/root /var/lib/containers btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@containers 0 1" >>$TARGET/etc/fstab
}
accounts() {
@ -334,7 +332,7 @@ accounts() {
}
btrfs-tweaks() {
DISABLE_COW=("/var/lib/docker" "/var/lib/containers" "/var/lib/postgres" "/var/lib/mysql" "/var/lib/libvirt");
DISABLE_COW=("/var/lib/docker" "/var/lib/containers" "/var/lib/postgresql" "/var/lib/mysql" "/var/lib/libvirt");
for i in "${DISABLE_COW[@]}"
do
@ -350,8 +348,6 @@ custom_service_files() {
echo "Description=Powertop tunings" >>$TARGET/etc/systemd/system/powertop.service
echo "[Service]" >>$TARGET/etc/systemd/system/powertop.service
echo "Type=oneshot" >>$TARGET/etc/systemd/system/powertop.service
echo "ExecPreStart=/usr/bin/cpupower frequency-set -g powersave -d 400MHz" >>$TARGET/etc/systemd/system/powertop.service
echo "ExecPreStart=/usr/bin/cpupower frequency-set -g powersave -u 2GHz" >>$TARGET/etc/systemd/system/powertop.service
echo "ExecStart=/usr/sbin/powertop --auto-tune" >>$TARGET/etc/systemd/system/powertop.service
echo "[Install]" >>$TARGET/etc/systemd/system/powertop.service
echo "WantedBy=multi-user.target" >>$TARGET/etc/systemd/system/powertop.service