Fedora-OSTree-Setup-dev / Fedora-OSTree-Setup

Glorified scipt that automates the setup of Fedora Silverblue/Kinoite based on given config file.
GNU General Public License v3.0
7 stars 3 forks source link

Make system easier #32

Open boredsquirrel opened 1 year ago

boredsquirrel commented 1 year ago
boredsquirrel commented 1 year ago
printf """R
Monero
crash-waydroid-journalctl.txt
hs_err_pid2.log
lynis.log
testdisk.log
qphotorec.log
repos
source""" > ~/.hidden

if you have files to add, add them here

boredsquirrel commented 1 year ago
mkdir -p ~/Tools/Folders
cd ~/Tools/Folders
printf """This is a folder containing useful symlinks (symbolic links) to hard to remember directories.

You can delete empty Symlinks, for Programs you don't use.""" > What-is-this.txt

ln -s ~/.mozilla/firefox/ Firefox
ln -s ~/.var/app/org.mozilla.firefox/.mozilla/firefox "Firefox Flatpak"
ln -s ~/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Brwser/ "Brave Flatpak"
ln -s ~/.var/app/org.libreoffice.LibreOffice/config/libreoffice Libreoffice
ln -s ~/.var/app/io.freetubeapp.FreeTube/config/FreeTube "FreeTube (experimental usage)"
ln -s ~/.config/autostart Autostart
ln -s ~/.local/share/applications Appstarters
ln -s ~/.local/share/Cryptomator/mnt/ "Cryptomator decrypted directory"
ln -s ~/.var/app Flatpak-Apps/

wget xxx/-README.md

mkdir z-Advanced
cd z-Advanced 

ln -s ~/.local/share/fonts Flatpak-Fonts
ln -s ~/usr/lib/systemd Systemd-Services
ln -s ~/.config/user-dirs.dirs "User Directories Config"
ln -s /var/usrlocal/bin "usrlocal bin Directory"
ln -s /etc/dnsmasq.conf "DNSMasq Config (block Domains locally)"
ln -s /etc/yum.repos.d "DNF repositories"
ln -s /etc/tlp.conf "TLP Config"
#ln -s /etc/bluetooth/main.conf "Bluetooth main Config"
#ln -s /etc/cups/cups-browsed.conf "CUPS browsed advanced Printer config"
#ln -s /etc/dnf/dnf.conf "DNF Config"
ln -s /etc/fail2ban "Fail2Ban (essential for servers)"
#ln -s /etc/fwupd "Firmware Updater Config"
ln -s /etc/geoclue/geoclue.conf "Geoclue Config"
#ln -s /etc/NetworkManager "Network Manager"
#ln -s /etc/ostree "OSTree config"
#ln -s /etc/pam.d "Pam Directory"
#ln -s /etc/pulse Pulse
#ln -s /etc/samba Samba
#ln -s /etc/security Security
#ln -s /etc/selinux SELinux
ln -s /etc/ssh SSH
#ln -s /etc/sysconfig Sysconfig
#ln -s /etc/sysctl.d Sysctl
#ln -s /etc/systemd Systemd-config
ln -s /etc/UPower UPower
#ln -s /etc/xdg XDG
ln -s /etc/fstab fstab
ln -s /etc/mime.types "MIME Types"
#ln -s /etc/rpm-ostreed.conf "RPM-Ostreed Config"
ln -s /etc/rsyncd.conf "RSync Config"
ln -s /etc/whois.conf "whois config"

mkdir SystemD
ln -s /etc/systemd user-services
ln -s /usr/lib/systemd app-services

cd ~/Tools/Folders
mkdir KDE
cd KDE
ln -s ~/.config/kded_device_automounterrc 'Automount Config'
ln -s ~/.config/konsolesshconfig 'Konsole SSH Config'
ln -s ~/.config/krunnerrc 'Krunner Config'
ln -s ~/.config/mimeapps.list Mimeapps
ln -s /usr/share/icons/ "System Icons"
ln -s /usr/share/wallpapers "System Wallpapers"

#wget README
mkdir Dolphin
cd Dolphin
ln -s ~/.config/kservicemenurc 'Servicemenu Config'
ln -s ~/.local/share/kservices5/ServiceMenus 'Servicemenus'
ln -s ~/.local/share/servicemenu-download 'Servicemenus Download'
ln -s ~/.local/share/templates '"create new" templates'

#wget README

cd ~/Tools/Folders
mkdir Waydroid
cd Waydroid
ln -s ~/.local/share/waydroid/data all-files

printf """[Desktop Entry]
Exec=pkexec env 'DISPLAY=$DISPLAY' 'XAUTHORITY=$XAUTHORITY' KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dolphin '~/.local/share/waydroid/data/media/0'
GenericName=opens the Waydroid folder, SUDO required
Icon=android-file-transfer
Name=Waydroid Folder
Type=Application""" > "~/.local/share/applications/Open Waydroid Folder.desktop

ln -s ~/.local/share/applications/Waydroid-Folder.desktop Waydroid-Folder.desktop

cd ~/Tools/Folders
mkdir GIMP
cd Gimp

ln -s ~/.var/app/org.gimp.GIMP/data/gegl-0.4/plug-ins "Gimp GEGL Plugins"
ln -s ~/.var/app/org.gimp.GIMP/config/GIMP "Gimp Configs"

#wget xxx/-README.md

cd ~/Tools/Folders
mkdir Tor-Browser
cd Tor-Browser

ln -s ~/.var/app/com.github.micahflee.torbrowser-launcher/data/torbrowser/tbb/x86_64/tor-browser/Browser/TorBrowser/Data/Browser "Tor Browser Profile"
ln -s ~/.var/app/com.github.micahflee.torbrowser-launcher/data/torbrowser/tbb/x86_64/tor-browser/Browser/TorBrowser/Docs Docs
ln -s ~/.var/app/com.github.micahflee.torbrowser-launcher/data/torbrowser/tbb/x86_64/tor-browser/Browser/Downloads Downloads

printf"""These are some folders that the Tor-Browser uses.

It emulates an artificial Desktop, fonts and Downloads, to create a universal appeareance.

Dont edit any files! Only backup/restore your Profile if you feel the need to, or access the Downloads.""" > -REAME.txt

Note: the location of Librewolf config is unclear. It was in ~/.librewolf for me, but this breaks functionality with the sandbox.

Note2: poorly you need root to open the waydroid folder. This way it works okay, but it only works on KDE, maybe there is a GNOME variant too. Maybe there also is a better way, if I find the time I can look for it.

For sure you can link waydroid folders with system folders, so you dont really need to access that folder.

boredsquirrel commented 1 year ago

what folder should be use for that? a direct "tools" folder? I find it immensly useful to have, especially if you give icons to the folders. This will be Filemanager-specific though I guess.

I would just create all and then let users delete them again. Should be no problem, but if we have a good copy-paste solution we could also do it like that.

iaacornus commented 1 year ago
  • [x] autoupdates

    • [x] Link useful folders:

    • [x] Flatpak app folder

    • [x] firefox folder ~/.mozilla/firefox/

    • [x] maybe Brave config folder ~/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/

    • [x] Libreoffice config folder ~/.var/app/org.libreoffice.LibreOffice/config/libreoffice

    • [x] Autostart folder ~/.config/autostart

    • [x] add .hidden file to $HOME

    • [ ] autoupdate Arkenfox user.js

i'm not sure what's the monero for, since it does not seem needed by the general user population, as well as arkenfox, most of the user in general population simply just use the rpm firefox without any tweaks or the flatpak firefox. I also don't know what is the autostart folder for as well as the hidden files

boredsquirrel commented 1 year ago

yes it is a bit bloated but I just included everything. Monero is removed, not needed. Arkenfox is more secure, it will be optional and during the creation generates a new profile, so even if you choose yes, you can just keep it as a second profile.

Autostart and other hidden files are useful imo, because you dont always have to Ctrl+H and search for the actually useful folders. I tried to focus on user-facing folders like Autostart, that are useful and allow user input.

iaacornus commented 1 year ago

yes it is a bit bloated but I just included everything. Monero is removed, not needed. Arkenfox is more secure, it will be optional and during the creation generates a new profile, so even if you choose yes, you can just keep it as a second profile.

12 is now prioritized

Autostart and other hidden files are useful imo, because you dont always have to Ctrl+H and search for the actually useful folders. I tried to focus on user-facing folders like Autostart, that are useful and allow user input.

yeah although what does the autostart and hidden files are for?

iaacornus commented 1 year ago

You can cleanup old deployments using these commands:

sudo ostree admin pin -u <index starting from 0>
sudo rpm-ostree cleanup remove -r

I usually pin the latest with sudo ostree admin pin 0 and clean the rest of my system with rpm-ostree cleanup -bmpr, followed by sudo ostree admin cleanup -v.

this may be automated and adapted to always keep the last backup, but for me I had 5 versions piling up.

At least I would add it to the "Tools" folder as a small script to run.

printf """#!/bin/bash
sudo ostree admin pin -u 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
sudo rpm-ostree cleanup remove -r
""" > ~/Tools/Scripts/OSTree-remove-old-deployments.sh

chmod +x ~/Tools/Scripts/OSTree-remove-old-deployments.sh

A way to determine the number of old deployments may be needed, if it stops when the number is too high. I tried counting "fedora:fedora" in the rpm-ostree status output with rpm-ostree status | tr -cd 'fedora:fedora' | wc -c but it doesnt work.

Keeping more than 1 backup is a huge usability problem though.

The grub issue showing everything as duplicates will be fixed in the future.

also, sudo is not needed by rpm-ostree.

boredsquirrel commented 1 year ago

The autostart folder can hold .desktop icons and scripts. KDE has a GUI for that, GNOME too? I had an incident where still something I removed through GUI was there.

You cant just rename files (with a dot to be hidden), and a lot of logs are not really ment to be always seen, some others are.

I just tried what could be useful, sometimes its way more efficient than doing it in the GUI.

iaacornus commented 1 year ago

crazy sudo is not needed!

yes the permission handling is done in polkit (discussion from here coreos/rpm-ostree#745)

Okay these commands seem better. the first removes the old deployments from the list and the second removes the files?

Should that be automated as an autostart script? Or would that be too invasive?

i don't think it's a good idea to make it a startup script, since for example in my case, i usually keep some version for backup purposes where i can reboot later, also rpm-ostree automatically removes other image layer, so we don't need to run a cleanup everytime.

iaacornus commented 1 year ago

The autostart folder can hold .desktop icons and scripts. KDE has a GUI for that, so maybe not needed. GNOME too?

yeah but what would it autostart tho? not sure what scripts, and .desktop goes to $HOME/.local/share/applications

boredsquirrel commented 1 year ago

The autostart folder can hold .desktop icons and scripts. KDE has a GUI for that, so maybe not needed. GNOME too?

yeah but what would it autostart tho? not sure what scripts, and .desktop goes to $HOME/.local/share/applications

It autostarts apps or scripts on ~system boot~ login. For me its:

iaacornus commented 1 year ago

The autostart folder can hold .desktop icons and scripts. KDE has a GUI for that, so maybe not needed. GNOME too?

yeah but what would it autostart tho? not sure what scripts, and .desktop goes to $HOME/.local/share/applications

It autostarts apps or scripts on ~system boot~ login. For me its:

* nextcloud

* cryptomator

* a Libreoffice table for my timetable

* a script setting my mic volume because its always too high

* a .desktop to enable journalctl logs in a Konsole window

* SyncThingy

* a script removing old backup files

that seems rather a personal modification rather than anyone would use for me. also what are these symlinks for?

ln -s ~/.mozilla/firefox/ Firefox
ln -s ~/.var/app/org.mozilla.firefox/.mozilla/firefox Firefox-Flatpak
ln -s ~/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/ Brave-Browser
ln -s ~/.var/app/org.libreoffice.LibreOffice/config/libreoffice Libreoffice
ln -s ~/.config/autostart Autostart
ln -s ~/.config Configuration
ln -s ~/.scripts User-Scripts
ln -s ~/.local/share/applications Appstarter
ln -s ~/.local/share/fonts Flatpak-Fonts
ln -s ~/.local/share/Cryptomator/mnt/ Cryptomator-decrypted
ln -s ~/.var/app Flatpak-Apps
ln -s ~/.config/user-dirs.dirs User-Directories

mkdir KDE
cd KDE
ln -s ~/.themes Themes
ln -s ~/.config/kde.org Configuration
ln -s ~/.config/kdedefaults KDE-Defaults
ln -s /usr/share/sddm/themes "SDDM-Themes (write only)"
ln -s ~/.config/menus Appmenu
ln -s ~/.config/discoverrc Discover-Settings
ln -s ~/.config/kdeglobals KDEglobals
ln -s ~/.config/kded_device_automounterrc Automount-Config
ln -s ~/.config/konsolesshconfig KonsoleSSH-Config
ln -s ~/.config/krunnerrc Krunner-Config
ln -s ~/.config/kservicemenurc Servicemenu-Config
ln -s ~/.config/kwinrc Kwin-Config
ln -s ~/.config/mimeapps.list Mimeapps
ln -s ~/.config/okularpartrc Okular-Config
ln -s ~/.config/spectaclerc Spectacle-Config
boredsquirrel commented 1 year ago

Oh forgot to answer. No autostart is not personal.

It is useful to have the folder there, because through KDE GUI you cant remove some things sometimes. Lots of things profit from autostarting, like Syncthing or Nextcloud, maybe your mail or chat client. You want them there and this is just to make manual configs easier.

The .var folders are for flatpak configs. Dealing with Firefox requires to know where that is, and flatpaks are complicated.

the .config can be removed, but its better than hiding-unhiding your things in /home all the time imo.

the appmenu actually looks understandable, so you could customized it there, and restore it from a previous version. So this is also useful for backup purposes. For example you backup all your data but dont have the apps installed. This menu will look weird then or even reset. After installing all the apps, you need to paste it there again.

discover settings are really easy to disable/enable Fedora Flatpaks and other stuff.

all the other folders are all selected for files that are readable and may be useful.

cryptomator-decrypted is very personal, but I dont know a (not overcomplicated like the json file for applications) way to select what folders to link. For example you will probably not need Firefox Flatpak, RPM and Brave folders, but you can just delete them there, thats what the message in the folders says.

the autostart autostarter is not needed on Silverblue and Kinoite.

boredsquirrel commented 1 year ago
print """ #!/bin/bash
# How to re-enable the power-profiles switcher if its gone?

sudo systemctl unmask power-profiles-daemon.service
sudo systemctl restart power-profiles-daemon.service

# Comment: Its said that this may conflict with TLP, but many use both together.
""" > ~/Tools/Scripts/reenable-power-profiles.sh

I had a problem where this was gone. Easy solution but not easy to find.

boredsquirrel commented 1 year ago

edited list of linked folders, focussing also on embracing users to create dolphin service menus more easily.

I like it very much now, it has all nessecary folders integrated and even a big list of useful advanced folders. we can make this optional of course, but I think its really neat.

boredsquirrel commented 1 year ago

warning: lit

printf """#!/bin/bash
pushd /tmp

author="$(echo $2 | cut -d '/' -f1)"
reponame="$(echo $2 | cut -d '/' -f2)"

if [ ! $3 ]; then
 releasever="$(rpm -E %fedora)"
else
 releasever=$3
fi

if [[ "$1" == "enable" ]]; then
 echo "$author/$reponame -> $releasever"
 curl -fsSL https://copr.fedorainfracloud.org/coprs/$author/$reponame/repo/fedora-$releasever/$author-$reponame-fedora-.repo | sudo tee /etc/yum.repos.d/$author-$reponame.repo
elif [[ "$1" == "remove" ]]; then
 sudo rm /etc/yum.repos.d/$author-$reponame.repo
fi
""" | sudo tee /var/usrlocal/bin/copr

sudo chmod +x /var/usrlocal/bin/copr

Now you can just use copr enable name/repo normally!

iaacornus commented 1 year ago
ln -s ~/.var/app/org.mozilla.firefox/.mozilla/firefox Firefox-Flatpak
ln -s ~/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/ Brave-Browser
ln -s ~/.var/app/org.libreoffice.LibreOffice/config/libreoffice Libreoffice

given that these dirs are hard to find, and people barely need to modify it by themselves, i dont really see a point of symlinking it that it would be exposed.

the autostart autostarter is not needed on Silverblue and Kinoite.

i mean the scope of this program is only for ostree systems right, which is only effectively silverblue and kinoite

the .config can be removed, but its better than hiding-unhiding your things in /home all the time imo.

well the thing is it would cluter the home dir, and layman really dont need t omodify and access .config folder everytime

It is useful to have the folder there, because through KDE GUI you cant remove some things sometimes. Lots of things profit from autostarting, like Syncthing or Nextcloud, maybe your mail or chat client. You want them there and this is just to make manual configs easier.

this seems a good idea now, thanks for clarifying

iaacornus commented 1 year ago
print """ #!/bin/bash
\# How to re-enable the power-profiles switcher if its gone?

sudo systemctl unmask power-profiles-daemon.service
sudo systemctl restart power-profiles-daemon.service

# Comment: Its said that this may conflict with TLP, but many use both together.
""" > ~/Tools/Scripts/reenable-power-profiles.sh

I had a problem where this was gone. Easy solution but not easy to find.

i'm not sure why would power-profiles daemon would even be masked in the first place

Comment: Its said that this may conflict with TLP, but many use both together.

""" > ~/Tools/Scripts/reenable-power-profiles.sh

its not recommended, hence it dont suggest using or installing both, if one should be installed one should be removed all together. But replacing power-profiles with tlp sounds good to me, since power-profiles doesnt always perform better, even worse at some times, tracked here #48

boredsquirrel commented 1 year ago

Hmm, I like the GUI integration to switch between power modes... have no problem using both I think?

boredsquirrel commented 1 year ago

Found out how to add new entries ("templates") to the "create new..." menu in Dolphin, would be really nice to add them seperately when installing Libreoffice, Krita, Inkscape, Gimp, KDEnlive e.g. as they dont have their own things.

They are just desktop files placed in ~/.local/share/templates, but they link to specific dirs so idk if they work directly

https://github.com/gmm96/KDE-5-Template-Manager/issues/15

I got a lot working now, perfect addition to Flatpak Libreoffice (most common example) or any other template you use often (create a .desktop preset file for anything)

boredsquirrel commented 1 year ago

Emojis

Some emojis where licensed, here is a freely accessable one

There is a tool to automatically download the latest Github release of something. We would need the Linux tar.gz, for the current version the command could be:

AppleEmojis (licensed)

wget https://github.com/samuelngs/apple-emoji-linux/releases/latest/download/AppleColorEmoji.ttf -P ~/.local/share/fonts
# update font cache
fc-cache -f -v

Twemoji

wget https://github.com/13rac1/twemoji-color-font/releases/download/v14.0.2/TwitterColorEmoji-SVGinOT-Linux-14.0.2.tar.gz -P ~/.local/share/fonts
# unpack and delete archive
tar -xfv ~/.local/share/fonts/TwitterColorEmoji-SVGinOT-Linux-14.0.2.tar.gz
rm ~/.local/share/fonts/TwitterColorEmoji-SVGinOT-Linux-14.0.2.tar.gz
# update font cache
fc-cache -f -v

this doesnt work for the system though, only for the apps. Pushing it to the system folder requires sudo, and I would prefer that.

Apple systemwide (licensed)

sudo wget https://github.com/samuelngs/apple-emoji-linux/releases/latest/download/AppleColorEmoji.ttf -P /usr/local/share/fonts/
# update font cache
sudo fc-cache -f -v

Twemoji systemwide

wget https://github.com/13rac1/twemoji-color-font/releases/download/v14.0.2/TwitterColorEmoji-SVGinOT-Linux-14.0.2.tar.gz
# unpack and delete archive
sudo tar -xfv TwitterColorEmoji-SVGinOT-Linux-14.0.2.tar.gz --directory /usr/local/share/fonts/
rm TwitterColorEmoji-SVGinOT-Linux-14.0.2.tar.gz
# update font cache
sudo fc-cache -f -v

Notes

Dont know if updating system font cache requires sudo.

downloading to home dir and unpacking to system dir requires less system modification, so I chose that.

Problems

Still when trying both system wide, it doesnt change copied and shown emojis from the clipboard. I guess the reason is, that there already are "google noto sans color emojis", which are displayed as white for me though. Removing them is not possible, because the system is only readable.

Deactivating the font through the KDE settings results in an error, that is not outputted when launching "systemsettings" from the Terminal.

sudo rm -f /usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf

would be the command to get rid of the Google emojis. But this needs to be somehow packed into an rpm-ostree override, dont know how this would currently be possible.

boredsquirrel commented 1 year ago
ln -s ~/.var/app/org.mozilla.firefox/.mozilla/firefox Firefox-Flatpak
ln -s ~/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/ Brave-Browser
ln -s ~/.var/app/org.libreoffice.LibreOffice/config/libreoffice Libreoffice

given that these dirs are hard to find, and people barely need to modify it by themselves, i dont really see a point of symlinking it that it would be exposed.

the autostart autostarter is not needed on Silverblue and Kinoite.

i mean the scope of this program is only for ostree systems right, which is only effectively silverblue and kinoite

the .config can be removed, but its better than hiding-unhiding your things in /home all the time imo.

well the thing is it would cluter the home dir, and layman really dont need t omodify and access .config folder everytime

It is useful to have the folder there, because through KDE GUI you cant remove some things sometimes. Lots of things profit from autostarting, like Syncthing or Nextcloud, maybe your mail or chat client. You want them there and this is just to make manual configs easier.

this seems a good idea now, thanks for clarifying

I move and delete Firefox stuff A LOT. Editing the UserChrome.css or the user.js, backing up the content to an external drive e.g. its useful, just disussable if we want the efford to make it manual and choose only one browser folder instead of (Firefox, Firefox Flatpak, Librewolf, Brave, Tor).

We have to see, this script is for regular users, but you dont have to click on a folder just because its there lol.

it just adds a single "Tools" folder to the home dir. In this folder there

Advanced folders:

very useful, and the advantage is efficiency, you dont have to look through lots of dirs you shouldnt even edit.

boredsquirrel commented 1 year ago
print """ #!/bin/bash
\# How to re-enable the power-profiles switcher if its gone?

sudo systemctl unmask power-profiles-daemon.service
sudo systemctl restart power-profiles-daemon.service

# Comment: Its said that this may conflict with TLP, but many use both together.
""" > ~/Tools/Scripts/reenable-power-profiles.sh

I had a problem where this was gone. Easy solution but not easy to find.

i'm not sure why would power-profiles daemon would even be masked in the first place

Comment: Its said that this may conflict with TLP, but many use both together.

""" > ~/Tools/Scripts/reenable-power-profiles.sh

its not recommended, hence it dont suggest using or installing both, if one should be installed one should be removed all together. But replacing power-profiles with tlp sounds good to me, since power-profiles doesnt always perform better, even worse at some times, tracked here #48

using TLP and power-profiles-daemon was a huge problem for my system, getting painfully slow and unusable. Thanks

iaacornus commented 1 year ago
print """ #!/bin/bash
\# How to re-enable the power-profiles switcher if its gone?

sudo systemctl unmask power-profiles-daemon.service
sudo systemctl restart power-profiles-daemon.service

# Comment: Its said that this may conflict with TLP, but many use both together.
""" > ~/Tools/Scripts/reenable-power-profiles.sh

I had a problem where this was gone. Easy solution but not easy to find.

i'm not sure why would power-profiles daemon would even be masked in the first place

Comment: Its said that this may conflict with TLP, but many use both together.

""" > ~/Tools/Scripts/reenable-power-profiles.sh

its not recommended, hence it dont suggest using or installing both, if one should be installed one should be removed all together. But replacing power-profiles with tlp sounds good to me, since power-profiles doesnt always perform better, even worse at some times, tracked here #48

using TLP and power-profiles-daemon was a huge problem for my system, getting painfully slow and unusable. Thanks

yep, the two conflicts with each other, so one should be removed, i will make an option for user which one to keep, and the one that will be kept will be optimized

boredsquirrel commented 1 year ago

I have a new laptop where tlp kills usb and probably HDMI too. But power-profiles also doesnt seem to work, really weird, AMD and all.

RyzenAdj also doesnt work on OSTree systems it seems, as this literally modifies the kernel or something.

So tlp or power-profiles has to be optional. I would preinstall tlp anyways as it doesnt hurt, but well.

#TLP:

sudo systemctl disable --now power-profiles-daemon
sudo systemctl mask power-profiles-daemon
sudo systemctl unmask tlp
sudo systemctl enable --now tlp
sudo nano /etc/tlp.d/00-Template.conf

# Power-profiles

sudo systemctl disable --now tlp
sudo systemctl mask tlp
sudo systemctl unmask power-profiles-daemon
sudo systemctl enable --now power-profiles-daemon

or something like that. I would add a custom preset file for tlp to that conf, its empty currently but docs are mentioned in the file, there is a wikipage.