PortValhalla/ManuSurface/ManuSurfaceSetup.md

200 lines
7.3 KiB
Markdown
Raw Normal View History

# ManuSurface Setup
The steps described here allow the creation of a linux system on a Surface Book 2.
- Rename host
- Install Brave
2022-11-10 23:19:30 +00:00
- ```bash
sudo apt install -y wget unzip jq apt-transport-https curl
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update
sudo apt install -y brave-browser
archiveName=$(mktemp)
wget https://github.com/dougppaz/youtube-music-dl/releases/download/v1.2.1/youtube-music-dl.zip -O $archiveName
extensionName=youtube-music-dl
contextRoot=$(mktemp -d)
extensionDir=$contextRoot/$extensionName
keyFile=$extensionDir.pem
extensionFile=$extensionDir.crx
manifestFile=$extensionDir/manifest.json
extensionRoot=/usr/share/brave-extensions
destination=$extensionRoot/$extensionName.crx
sudo mkdir -p $extensionRoot
unzip $archiveName -d $extensionDir
brave-browser --pack-extension=$extensionDir
manifest="$(cat $manifestFile | jq ". + {key: "'"'"$(openssl rsa -in $keyFile -pubout -outform DER | openssl base64 -A)"'"'"}")"
manifest="$(echo $manifest | jq ".background.persistent = false")"
echo $manifest > $manifestFile
extensionID=$(openssl rsa -in $keyFile -pubout -outform DER | shasum -a 256 | head -c32 | tr 0-9a-f a-p)
extensionVersion=$(cat $manifestFile | jq -r '.version')
brave-browser --pack-extension=$extensionDir --pack-extension-key=$keyFile
sudo cp $extensionFile $extensionRoot
configRoot=/opt/brave.com/brave/extensions/
sudo rm -rf $contextRoot
sudo chmod -R a+rx $extensionRoot
sudo chmod -R u+w $extensionRoot
sudo mkdir -p $configRoot
{
echo "{"
echo ' "external_crx": "'"$destination"'",'
echo ' "external_version": "'"$extensionVersion"'"'
echo "}"
} | sudo tee $configRoot/$extensionID.json
2022-11-10 23:19:30 +00:00
```
- Install Bitwarden
2022-11-10 17:24:02 +00:00
- Install Xournal++
2022-11-10 23:19:30 +00:00
- Install Signal
- Install Steam
- Install Bottles
2022-11-10 17:24:02 +00:00
- Install codium:
```bash
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg \
| gpg --dearmor \
| sudo dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main'
| sudo tee /etc/apt/sources.list.d/vscodium.list
sudo apt update
sudo apt install codium
```
- Generate SSH-key
- Install `linux-surface`
See: <https://github.com/linux-surface/linux-surface/wiki/Installation-and-Setup>
- ```bash
wget -qO - https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
| gpg --dearmor | sudo dd of=/etc/apt/trusted.gpg.d/linux-surface.gpg
```
- ```bash
echo "deb [arch=amd64] https://pkg.surfacelinux.com/debian release main" \
| sudo tee /etc/apt/sources.list.d/linux-surface.list
```
- ```bash
sudo apt update
```
- ```bash
sudo apt install linux-image-surface linux-headers-surface iptsd libwacom-surface
```
- ```bash
sudo systemctl enable iptsd
```
2022-11-10 23:19:30 +00:00
- ```bash
wget https://github.com/linux-surface/surface-dtx-daemon/releases/download/v0.3.3-2/surface-dtx-daemon_0.3.3-2_amd64.deb -O dtx.deb
sudo dpkg -i dtx.deb
rm dtx.deb
```
- Enable Secure Boot
As seen here: <https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#Set_up_shim>
- Implement Secure Boot
- Copy signed Bootloader to UEFI partition:
```bash
wget https://blog.hansenpartnership.com/wp-uploads/2013/HashTool.efi
wget https://blog.hansenpartnership.com/wp-uploads/2013/PreLoader.efi
cp {HashTool,PreLoader}.efi /boot/efi/EFI/systemd/
cp /boot/efi/EFI/systemd/systemd-bootx64.efi /boot/efi/EFI/systemd/loader.efi
```
- Add boot entry
```bash
efibootmgr --unicode --disk /dev/nvme0n1 --part 0 --create --label "PreLoader" --loader /EFI/systemd/PreLoader.efi
```
- Add fallbacks
```bash
cp ./HashTool.efi /boot/efi/EFI/BOOT/
cp /boot/efi/EFI/systemd/systemd-bootx64.efi /boot/efi/EFI/BOOT/loader.efi
cp ./PreLoader.efi /boot/efi/EFI/BOOT/BOOTx64.EFI
```
- Ensure support for Microsoft infected devices
```bash
mkdir -p /boot/efi/EFI/Microsoft/Boot
cp ./PreLoader.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
cp ./HashTool.efi /boot/efi/EFI/Microsoft/Boot/
cp /boot/efi/EFI/systemd/systemd-bootx64.efi /boot/efi/EFI/Microsoft/Boot/loader.efi
```
- Install `tea`
```bash
wget https://dl.gitea.io/tea/0.9.0/tea-0.9.0-linux-amd64 -O tea
sudo install tea /usr/local/bin
rm tea
```
## Enhancement
- Install `Gnome Extension Manager`
- Install Extensions `Clipboard Indicator`
2022-11-10 17:24:02 +00:00
- Sync NextCloud
```bash
sudo -v ; curl https://rclone.org/install.sh | sudo bash
rclone config # add remote
2022-11-10 23:17:38 +00:00
cp ./services/rclone@.service ~/.config/systemd/user/
2022-11-10 17:24:02 +00:00
systemctl --user daemon-reload
systemctl --user enable rclone@nextcloud:Nextcloud
systemctl --user start rclone@nextcloud:Nextcloud
```
- Install `oh-my-posh`
```bash
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
sudo chmod +x /usr/local/bin/oh-my-posh
echo 'eval "$(oh-my-posh init bash --config ~/Nextcloud/.omp/manuel.omp.json)"' >> ~/.bashrc
```
- Install `logo-ls`
```bash
sudo wget https://github.com/Yash-Handa/logo-ls/releases/download/v1.3.7/logo-ls_amd64.deb -O logo-ls.deb
sudo dpkg -i logo-ls.deb
{
echo "alias ls='logo-ls -D'"
2022-11-11 10:24:37 +00:00
echo "alias ll='ls -al'"
echo "alias l='ls'"
2022-11-10 17:24:02 +00:00
} >> ~/.bashrc
```
2022-11-10 23:19:30 +00:00
- Improve audio quality
```bash
cp ./equalizer/Default.json ~/.var/app/com.github.wwmm.easyeffects/config/easyeffects/output/
```
2022-11-11 10:24:51 +00:00
- Install python
```bash
sudo apt install python3 python-is-python3 python3-pip
```
- Install pyenv
```bash
curl https://pyenv.run | bash
{
echo ""
echo "# pyenv"
echo 'export PYENV_ROOT="$HOME/.pyenv"'
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"'
echo 'eval "$(pyenv init -)"'
echo 'eval "$(pyenv virtualenv-init -)"'
} >> ~/.bashrc
```
## Post-Install
- Add SSH-key to GitHub/Gitea websites
- Add Caskaydia Cove Nerd Font Regular to /usr/share/font/opentype
## Configuration
- Desktop
- Desktop Options
- Super Key Action: Applications
- Power
- Power Saving Options
- Disable "Automatic Screen Brightness"
- Suspend & Power Button
- Power Button Behavior: "Suspend"
- Enable "Show Battery Percentage"
- Mouse & Touchpad
- Touchpad Scroll & Zoom Options
- Enable "Natural Scrolling"
- Date & Time
- Time Format: 24-hour
- OS Upgrade & Recovery
- Update Recovery Partition