Skip to content

Instantly share code, notes, and snippets.

@pbrilius
Last active March 7, 2026 17:21
Show Gist options
  • Select an option

  • Save pbrilius/a8b4b71bc4524e74c31ae48ca1d4e020 to your computer and use it in GitHub Desktop.

Select an option

Save pbrilius/a8b4b71bc4524e74c31ae48ca1d4e020 to your computer and use it in GitHub Desktop.
Chuwi Kubuntu dodgy doogee umidigi SS
#!/bin/bash
# ============================================================
# CHUWI FreeBook 13.5 β€” Kubuntu 24.04 LTS Post-Install Script
# Intel N150 | 16GB RAM | KDE Plasma | U-Green USB-C Hub
# Linux Foundation Compliant | U-Green Style DE
# ============================================================
set -e
echo "🐧 CHUWI FreeBook β€” Kubuntu Post-Install Starting..."
echo "============================================================"
# ------------------------------------------------------------
# 1. SYSTEM UPDATE
# ------------------------------------------------------------
echo "πŸ“¦ [1/12] Updating system packages..."
sudo apt update && sudo apt full-upgrade -y
sudo apt autoremove -y && sudo apt autoclean -y
# ------------------------------------------------------------
# 2. INTEL N150 DRIVERS & FIRMWARE
# ------------------------------------------------------------
echo "βš™οΈ [2/12] Installing Intel N150 drivers & firmware..."
sudo apt install -y \
intel-microcode \
firmware-linux \
firmware-linux-nonfree \
xserver-xorg-video-intel \
intel-gpu-tools \
libdrm-intel1 \
vainfo \
intel-media-va-driver
# Enable hardware video acceleration (VA-API)
sudo tee /etc/environment <<EOF
LIBVA_DRIVER_NAME=iHD
EOF
# ------------------------------------------------------------
# 3. TOUCHSCREEN & TABLET MODE (360Β° HINGE)
# ------------------------------------------------------------
echo "πŸ–οΈ [3/12] Setting up touchscreen & auto-rotate..."
sudo apt install -y \
iio-sensor-proxy \
xserver-xorg-input-libinput \
libinput-tools
sudo systemctl enable iio-sensor-proxy
sudo systemctl start iio-sensor-proxy
# Touchscreen libinput config
sudo tee /etc/X11/xorg.conf.d/40-touchscreen.conf <<EOF
Section "InputClass"
Identifier "CHUWI Touchscreen"
MatchIsTouchscreen "on"
Driver "libinput"
Option "Tapping" "on"
Option "NaturalScrolling" "true"
Option "DisableWhileTyping" "true"
EndSection
EOF
# ------------------------------------------------------------
# 4. USB-C / HDMI DISPLAY PASSTHROUGH
# ------------------------------------------------------------
echo "πŸ–₯️ [4/12] Configuring USB-C HDMI passthrough..."
sudo apt install -y \
kscreen \
libdrm-dev \
drm-info
# KDE display config script
tee ~/.local/bin/display-setup.sh <<'EOF'
#!/bin/bash
# U-Green Hub β€” HDMI Extended Display Setup
# Detect connected outputs
INTERNAL="eDP-1"
EXTERNAL="HDMI-1"
if kscreen-doctor -o | grep -q "$EXTERNAL connected"; then
echo "External display detected β€” enabling extended desktop..."
kscreen-doctor \
output.$INTERNAL.enable \
output.$INTERNAL.position.0,0 \
output.$EXTERNAL.enable \
output.$EXTERNAL.position.2256,0 \
output.$EXTERNAL.mode.1920x1080@60
else
echo "No external display β€” using internal only..."
kscreen-doctor output.$INTERNAL.enable
fi
EOF
chmod +x ~/.local/bin/display-setup.sh
# ------------------------------------------------------------
# 5. KDE PLASMA OPTIMIZATIONS FOR N150
# ------------------------------------------------------------
echo "🎨 [5/12] Optimizing KDE Plasma for N150..."
# HiDPI scaling for 2256x1504
kwriteconfig5 --file kdeglobals --group KScreen --key ScaleFactor 1.5
# Compositor β€” OpenGL 2.0 for stability on Intel UHD
kwriteconfig5 --file kwinrc --group Compositing --key Backend "OpenGL"
kwriteconfig5 --file kwinrc --group Compositing --key GLCore false
kwriteconfig5 --file kwinrc --group Compositing --key OpenGLIsUnsafe false
# Disable heavy animations to save CPU
kwriteconfig5 --file kdeglobals --group KDE --key AnimationDurationFactor 0.5
# Wayland session (KDE Plasma 6 default)
sudo tee /etc/sddm.conf.d/wayland.conf <<EOF
[General]
DisplayServer=wayland
GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell
EOF
# ------------------------------------------------------------
# 6. SHELL ENVIRONMENT (ZSH + OH-MY-ZSH + U-GREEN THEME)
# ------------------------------------------------------------
echo "🐚 [6/12] Setting up Zsh + Oh-My-Zsh (U-Green style)..."
sudo apt install -y zsh curl git fonts-powerline
# Install Oh-My-Zsh non-interactively
RUNZSH=no CHSH=no sh -c \
"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Install plugins
git clone https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# U-Green style .zshrc
tee ~/.zshrc <<'EOF'
# CHUWI FreeBook β€” U-Green Zsh Config
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="agnoster"
plugins=(git zsh-autosuggestions zsh-syntax-highlighting sudo kubectl docker)
source $ZSH/oh-my-zsh.sh
# U-Green Prompt Style
PROMPT='%F{green}β”Œβ”€β”€(%F{cyan}%n@%m%F{green})%f %F{white}%~%f
%F{green}└─❯%f '
# Aliases
alias ll='ls -lah --color=auto'
alias update='sudo apt update && sudo apt full-upgrade -y'
alias kscreen-ext='~/.local/bin/display-setup.sh'
alias chuwi-info='inxi -Fxz'
alias ram='free -h'
alias temp='sensors'
# Environment
export EDITOR=nano
export LIBVA_DRIVER_NAME=iHD
export MOZ_ENABLE_WAYLAND=1
export QT_QPA_PLATFORM=wayland
EOF
# Set Zsh as default shell
sudo chsh -s $(which zsh) $USER
# ------------------------------------------------------------
# 7. KONSOLE β€” U-GREEN TERMINAL THEME
# ------------------------------------------------------------
echo "πŸ’š [7/12] Configuring Konsole U-Green theme..."
mkdir -p ~/.local/share/konsole
tee ~/.local/share/konsole/UGreen.colorscheme <<'EOF'
[Background]
Color=13,17,23
[BackgroundFaint]
Color=13,17,23
[BackgroundIntense]
Color=13,17,23
[Color0]
Color=0,0,0
[Color1]
Color=255,85,85
[Color2]
Color=57,255,20
[Color3]
Color=255,215,0
[Color4]
Color=0,120,215
[Color5]
Color=180,0,255
[Color6]
Color=0,255,200
[Color7]
Color=200,200,200
[Foreground]
Color=57,255,20
[General]
Description=U-Green
Opacity=0.92
Wallpaper=
EOF
tee ~/.local/share/konsole/CHUWI.profile <<'EOF'
[Appearance]
ColorScheme=UGreen
Font=JetBrains Mono,12,-1,5,50,0,0,0,0,0
[General]
Name=CHUWI-UGreen
Parent=FALLBACK/
Command=/usr/bin/zsh
[Scrolling]
HistorySize=10000
EOF
# ------------------------------------------------------------
# 8. DEVELOPMENT STACK (LAMP / XAMPP EQUIVALENT)
# ------------------------------------------------------------
echo "🌐 [8/12] Installing LAMP development stack..."
sudo apt install -y \
apache2 \
php8.3 php8.3-cli php8.3-curl php8.3-mbstring \
php8.3-xml php8.3-zip php8.3-mysql php8.3-gd \
mariadb-server mariadb-client \
phpmyadmin \
composer \
nodejs npm
# Optimize MariaDB for N150 16GB RAM
sudo tee /etc/mysql/mariadb.conf.d/99-chuwi.cnf <<EOF
[mysqld]
innodb_buffer_pool_size = 256M
max_connections = 50
query_cache_size = 32M
tmp_table_size = 64M
EOF
# Optimize Apache for low-power
sudo tee /etc/apache2/conf-available/chuwi.conf <<EOF
ServerName localhost
MaxRequestWorkers 50
KeepAliveTimeout 5
EOF
sudo a2enconf chuwi
sudo systemctl restart apache2
# ------------------------------------------------------------
# 9. WSL2-STYLE TOOLS (NATIVE LINUX EQUIVALENT)
# ------------------------------------------------------------
echo "πŸ‹ [9/12] Installing container & dev tools..."
sudo apt install -y \
docker.io \
docker-compose \
podman \
flatpak \
snapd \
git \
curl \
wget \
htop \
btop \
neofetch \
inxi \
lm-sensors \
net-tools \
openssh-server \
python3 python3-pip python3-venv \
default-jdk \
code # VS Code via snap below
# Add user to docker group
sudo usermod -aG docker $USER
# VS Code
sudo snap install code --classic
# Flatpak repos
flatpak remote-add --if-not-exists flathub \
https://flathub.org/repo/flathub.flatpakrepo
# ------------------------------------------------------------
# 10. POWER MANAGEMENT FOR N150
# ------------------------------------------------------------
echo "πŸ”‹ [10/12] Optimizing power management..."
sudo apt install -y \
tlp tlp-rdw \
powertop \
cpufrequtils
sudo systemctl enable tlp
sudo systemctl start tlp
# TLP config for N150
sudo tee /etc/tlp.d/99-chuwi.conf <<EOF
# CHUWI FreeBook N150 Power Profile
CPU_SCALING_GOVERNOR_ON_AC=performance
CPU_SCALING_GOVERNOR_ON_BAT=powersave
CPU_ENERGY_PERF_POLICY_ON_AC=performance
CPU_ENERGY_PERF_POLICY_ON_BAT=power
PLATFORM_PROFILE_ON_AC=performance
PLATFORM_PROFILE_ON_BAT=low-power
NMI_WATCHDOG=0
EOF
# ------------------------------------------------------------
# 11. U-GREEN HUB UDEV RULES
# ------------------------------------------------------------
echo "πŸ”Œ [11/12] Setting up U-Green hub udev rules..."
sudo tee /etc/udev/rules.d/99-ugreen-hub.rules <<EOF
# U-Green USB-C Hub β€” auto-mount and power rules
ACTION=="add", SUBSYSTEM=="usb", \
ATTR{idVendor}=="2109", \
RUN+="/usr/bin/logger U-Green Hub connected"
# USB-C DisplayPort hotplug
ACTION=="change", SUBSYSTEM=="drm", \
RUN+="/usr/bin/systemctl restart display-manager"
EOF
sudo udevadm control --reload-rules
# ------------------------------------------------------------
# 12. FINAL CLEANUP & SYSTEM INFO
# ------------------------------------------------------------
echo "🧹 [12/12] Final cleanup..."
sudo apt autoremove -y
sudo apt autoclean -y
sudo updatedb 2>/dev/null || true
echo ""
echo "============================================================"
echo "βœ… CHUWI FreeBook Kubuntu Setup COMPLETE!"
echo "============================================================"
echo ""
echo "πŸ“‹ System Summary:"
echo " OS : Kubuntu 24.04 LTS"
echo " Shell : Zsh + Oh-My-Zsh (U-Green theme)"
echo " DE : KDE Plasma (Wayland)"
echo " Display : HiDPI 150% | USB-C HDMI passthrough ready"
echo " Dev : LAMP + Docker + Node.js + Python3"
echo " Power : TLP optimized for N150"
echo " Hub : U-Green USB-C udev rules loaded"
echo ""
echo "πŸ” Please REBOOT to apply all changes:"
echo " sudo reboot"
echo ""
neofetch

Comments are disabled for this gist.