#!/bin/bash # ═══════════════════════════════════════════════════════════════ # Alfred Linux v2.0 — Post-Build Customization Hook # # This runs inside the chroot during ISO build. # Applies branding, security hardening, and default configs. # BUILD: v2.0-b1 (Branding) # ═══════════════════════════════════════════════════════════════ set -e echo "[Alfred Linux v2.0] Applying customizations..." # ── 1. Disable telemetry services ── TELEMETRY_SERVICES=( "apport" "whoopsie" "ubuntu-report" "popularity-contest" ) for svc in "${TELEMETRY_SERVICES[@]}"; do systemctl disable "$svc" 2>/dev/null || true systemctl mask "$svc" 2>/dev/null || true done apt-get purge -y apport whoopsie ubuntu-report popularity-contest 2>/dev/null || true # ── 2. Firewall defaults ── ufw default deny incoming ufw default allow outgoing ufw allow ssh ufw --force enable # ── 3. SSH hardening ── cat > /etc/ssh/sshd_config.d/alfred-hardening.conf << 'SSHD' PermitRootLogin no PasswordAuthentication yes PubkeyAuthentication yes X11Forwarding no AllowAgentForwarding no GatewayPorts no PermitEmptyPasswords no MaxAuthTries 3 LoginGraceTime 30 SSHD # ── 4. XFCE4 terminal defaults ── mkdir -p /etc/skel/.config/xfce4/terminal cat > /etc/skel/.config/xfce4/terminal/terminalrc << 'TERM' [Configuration] FontName=JetBrains Mono 11 MiscAlwaysShowTabs=FALSE MiscBell=FALSE MiscBellUrgent=FALSE MiscBordersDefault=TRUE MiscCursorBlinks=TRUE MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK MiscDefaultGeometry=120x35 MiscInheritGeometry=FALSE MiscMenubarDefault=FALSE MiscMouseAutohide=TRUE MiscMouseWheelZoom=TRUE MiscToolbarDefault=FALSE MiscConfirmClose=TRUE MiscCycleTabs=TRUE MiscTabCloseButtons=TRUE MiscTabCloseMiddleClick=TRUE MiscTabPosition=GTK_POS_TOP MiscHighlightUrls=TRUE MiscMiddleClickOpensUri=FALSE MiscCopyOnSelect=FALSE MiscShowRelaunchDialog=TRUE MiscRewrapOnResize=TRUE MiscUseShiftArrowsToScroll=FALSE MiscSlimTabs=FALSE MiscNewTabAdjacent=FALSE MiscSearchDialogOpacity=100 MiscShowUnsafePasteDialog=TRUE ScrollingUnlimited=TRUE BackgroundMode=TERMINAL_BACKGROUND_TRANSPARENT BackgroundDarkness=0.920000 ColorForeground=#e8e8f0 ColorBackground=#0a0a14 ColorCursor=#00D4FF ColorCursorUseDefault=FALSE ColorPalette=#1a1a2e;#e74c3c;#00b894;#fdcb6e;#0984e3;#7D00FF;#00D4FF;#e8e8f0;#8a8a9a;#e74c3c;#00b894;#fdcb6e;#0984e3;#a78bfa;#00D4FF;#ffffff TERM # ── 5. Custom bash prompt for Alfred Linux ── cat >> /etc/skel/.bashrc << 'BASHRC' # Alfred Linux prompt parse_git_branch() { git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } PS1='\[\e[36m\]\u@alfred\[\e[0m\]:\[\e[35m\]\w\[\e[32m\]$(parse_git_branch)\[\e[0m\]\$ ' # Alfred Linux aliases alias ll='ls -lah --color=auto' alias la='ls -A --color=auto' alias update='sudo apt update && sudo apt upgrade -y' alias ports='ss -tulpn' alias myip='curl -s ifconfig.me' alias cls='clear' # Welcome message if [[ -z "$ALFRED_WELCOMED" ]]; then echo -e "\e[36m" echo " ╔═══════════════════════════════════════╗" echo " ║ Alfred Linux 2.0 — Sovereign ║" echo " ║ No telemetry. No tracking. Yours. ║" echo " ╚═══════════════════════════════════════╝" echo -e "\e[0m" export ALFRED_WELCOMED=1 fi BASHRC # ── 6. Neofetch config with custom Alfred ASCII art ── mkdir -p /etc/skel/.config/neofetch cat > /etc/skel/.config/neofetch/config.conf << 'NEOCONF' print_info() { info title info underline info "OS" distro info "Host" model info "Kernel" kernel info "Uptime" uptime info "Packages" packages info "Shell" shell info "DE" de info "WM" wm info "Terminal" term info "CPU" cpu info "GPU" gpu info "Memory" memory info "Disk" disk info "Network" local_ip info cols } image_backend="ascii" image_source="/etc/alfred-ascii.txt" ascii_colors=(6 5 4 6 5 4) NEOCONF # Create Alfred ASCII art for neofetch cat > /etc/alfred-ascii.txt << 'ASCII' .---. / \ | A L | | F R | | E D | \_____/ .----' '----. / \ | ███████████████ | | █ █ | | █ SOVEREIGN █ | | █ LINUX █ | | █ █ | | ███████████████ | \ / '-----. .-----' | | / \ '-------' ASCII # ── 7. Generate wallpapers via ImageMagick (if available) ── mkdir -p /usr/share/backgrounds/alfred-linux if command -v convert &>/dev/null; then # Dark sovereign wallpaper — gradient background with logo text convert -size 1920x1080 \ -define gradient:angle=135 \ gradient:'#0a0a14-#1a1a2e' \ -gravity center \ -fill '#00D4FF' -font 'DejaVu-Sans-Bold' -pointsize 72 \ -annotate +0-100 'Alfred Linux' \ -fill '#8a8a9a' -font 'DejaVu-Sans' -pointsize 28 \ -annotate +0-20 'Sovereign Computing' \ -fill '#0984e3' -pointsize 18 \ -annotate +0+40 'No telemetry. No tracking. Yours.' \ /usr/share/backgrounds/alfred-linux/default.png 2>/dev/null || echo "[WARN] Wallpaper generation failed" # Minimal dark wallpaper convert -size 1920x1080 \ -define gradient:angle=180 \ gradient:'#0a0a14-#12121f' \ /usr/share/backgrounds/alfred-linux/dark-minimal.png 2>/dev/null || true # Accent wallpaper — subtle glow convert -size 1920x1080 xc:'#0a0a14' \ -fill 'radial-gradient:' \ -draw "fill #0984e320 circle 960,540 960,800" \ /usr/share/backgrounds/alfred-linux/accent-glow.png 2>/dev/null || \ convert -size 1920x1080 \ -define gradient:angle=135 \ gradient:'#0a0a14-#0d1a2a' \ /usr/share/backgrounds/alfred-linux/accent-glow.png 2>/dev/null || true else echo "[WARN] ImageMagick (convert) not found — wallpapers not generated" fi # ── 8. XFCE4 desktop settings — set wallpaper ── mkdir -p /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml cat > /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml << 'DESKXML' DESKXML # ── 9. Plymouth boot theme ── mkdir -p /usr/share/plymouth/themes/alfred cat > /usr/share/plymouth/themes/alfred/alfred.plymouth << 'PLY' [Plymouth Theme] Name=Alfred Linux Description=Alfred Linux boot splash ModuleName=script [script] ImageDir=/usr/share/plymouth/themes/alfred ScriptFile=/usr/share/plymouth/themes/alfred/alfred.script PLY cat > /usr/share/plymouth/themes/alfred/alfred.script << 'PLYSCRIPT' # Alfred Linux Plymouth Script Theme # Dark background with centered text Window.SetBackgroundTopColor(0.039, 0.039, 0.078); Window.SetBackgroundBottomColor(0.102, 0.102, 0.180); # Text sprite text_sprite = Sprite(); text_image = Image.Text("Alfred Linux", 0, 0.831, 1.0, 1, "Sans Bold 32"); text_sprite.SetImage(text_image); text_sprite.SetX(Window.GetWidth() / 2 - text_image.GetWidth() / 2); text_sprite.SetY(Window.GetHeight() / 2 - 60); sub_sprite = Sprite(); sub_image = Image.Text("Sovereign Computing", 0.541, 0.541, 0.604, 1, "Sans 16"); sub_sprite.SetImage(sub_image); sub_sprite.SetX(Window.GetWidth() / 2 - sub_image.GetWidth() / 2); sub_sprite.SetY(Window.GetHeight() / 2); # Progress bar progress_box.image = Image("progress_box.png"); progress_bar.original_image = Image("progress_bar.png"); # Callback for boot progress fun boot_progress_cb(time, progress) { if (progress_bar.original_image) { progress_bar.image = progress_bar.original_image.Scale( progress_bar.original_image.GetWidth() * progress, progress_bar.original_image.GetHeight() ); progress_bar.sprite.SetImage(progress_bar.image); } } Plymouth.SetBootProgressFunction(boot_progress_cb); # Message callback message_sprite = Sprite(); fun message_cb(text) { msg_image = Image.Text(text, 0.541, 0.541, 0.604, 1, "Sans 12"); message_sprite.SetImage(msg_image); message_sprite.SetX(Window.GetWidth() / 2 - msg_image.GetWidth() / 2); message_sprite.SetY(Window.GetHeight() - 60); } Plymouth.SetMessageFunction(message_cb); PLYSCRIPT # Generate plymouth progress bar images if command -v convert &>/dev/null; then convert -size 400x8 xc:'#1a1a2e' /usr/share/plymouth/themes/alfred/progress_box.png 2>/dev/null || true convert -size 400x8 xc:'#00D4FF' /usr/share/plymouth/themes/alfred/progress_bar.png 2>/dev/null || true fi # Set as default plymouth theme if command -v plymouth-set-default-theme &>/dev/null; then plymouth-set-default-theme -R alfred 2>/dev/null || true elif [ -f /etc/plymouth/plymouthd.conf ]; then sed -i 's/^Theme=.*/Theme=alfred/' /etc/plymouth/plymouthd.conf 2>/dev/null || true fi # Also register as an alternative update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth \ /usr/share/plymouth/themes/alfred/alfred.plymouth 200 2>/dev/null || true # ── 10. GRUB branding ── if [ -f /etc/default/grub ]; then sed -i 's/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR="Alfred Linux"/' /etc/default/grub # Add gfxmode if not present grep -q '^GRUB_GFXMODE=' /etc/default/grub || echo 'GRUB_GFXMODE=1920x1080' >> /etc/default/grub fi # GRUB theme directory mkdir -p /boot/grub/themes/alfred cat > /boot/grub/themes/alfred/theme.txt << 'GRUBTHEME' desktop-color: "#0a0a14" title-text: "Alfred Linux 2.0" title-color: "#00D4FF" title-font: "DejaVu Sans Bold 24" message-color: "#8a8a9a" message-font: "DejaVu Sans 14" + boot_menu { left = 25% top = 30% width = 50% height = 50% item_color = "#e8e8f0" selected_item_color = "#00D4FF" item_font = "DejaVu Sans 16" selected_item_font = "DejaVu Sans Bold 16" item_height = 30 item_padding = 5 item_spacing = 5 } + progress_bar { id = "__timeout__" left = 30% top = 85% width = 40% height = 10 fg_color = "#00D4FF" bg_color = "#1a1a2e" border_color = "#333355" text_color = "#e8e8f0" } GRUBTHEME # ── 11. LightDM greeter config ── mkdir -p /etc/lightdm cat > /etc/lightdm/lightdm-gtk-greeter.conf << 'LDM' [greeter] background=/usr/share/backgrounds/alfred-linux/default.png theme-name=Arc-Dark icon-theme-name=Papirus-Dark font-name=Inter 11 position=50%,center 50%,center panel-position=bottom clock-format=%A, %B %d %H:%M indicators=~host;~spacer;~clock;~spacer;~session;~a11y;~power LDM # ── 11b. LightDM autologin for live session ── mkdir -p /etc/lightdm/lightdm.conf.d cat > /etc/lightdm/lightdm.conf.d/50-alfred-autologin.conf << 'AUTOLOGIN' [Seat:*] autologin-user=user autologin-user-timeout=0 autologin-session=xfce AUTOLOGIN # ── 12. System branding — v2.0 ── cat > /etc/os-release << 'OSREL' PRETTY_NAME="Alfred Linux 2.0" NAME="Alfred Linux" VERSION_ID="2.0" VERSION="2.0 (Sovereign)" VERSION_CODENAME=sovereign ID=alfred-linux ID_LIKE=debian HOME_URL="https://alfredlinux.com" SUPPORT_URL="https://gositeme.com/support.php" BUG_REPORT_URL="https://gositeme.com/support.php" OSREL cat > /etc/issue << 'ISSUE' Alfred Linux 2.0 (Sovereign) The Sovereign Operating System \n \l ISSUE cat > /etc/issue.net << 'ISSUENET' Alfred Linux 2.0 (Sovereign) ISSUENET echo "Alfred Linux 2.0" > /etc/debian_chroot # ── 13. XFCE Panel branding ── mkdir -p /etc/skel/.config/xfce4/panel # Panel config will be created by XFCE on first login # We just ensure the icon is available mkdir -p /usr/share/icons/hicolor/48x48/apps/ if command -v convert &>/dev/null; then # Generate simple Alfred icon (blue circle with "A") convert -size 48x48 xc:'#00D4FF' \ -fill '#0a0a14' -font 'DejaVu-Sans-Bold' -pointsize 32 \ -gravity center -annotate +0+0 'A' \ -alpha set -virtual-pixel transparent \ \( +clone -threshold -1 -negate -morphology Distance Euclidean:1,20\! \ -level 60%,100% \) \ -compose DstIn -composite \ /usr/share/icons/hicolor/48x48/apps/alfred-linux.png 2>/dev/null || true # Also create 128x128 and 256x256 versions for size in 128 256; do mkdir -p /usr/share/icons/hicolor/${size}x${size}/apps/ convert -size ${size}x${size} xc:'#00D4FF' \ -fill '#0a0a14' -font 'DejaVu-Sans-Bold' -pointsize $((size*2/3)) \ -gravity center -annotate +0+0 'A' \ /usr/share/icons/hicolor/${size}x${size}/apps/alfred-linux.png 2>/dev/null || true done fi # ── 14. WireGuard mesh-ready config wizard ── cat > /usr/local/bin/alfred-mesh-setup << 'MESHSCRIPT' #!/bin/bash echo "" echo " ╔═══════════════════════════════════════╗" echo " ║ Alfred Mesh Network Setup ║" echo " ╚═══════════════════════════════════════╝" echo "" echo "This wizard will help you join the Alfred mesh network." echo "" echo "1. Generate new WireGuard keypair" echo "2. Import existing config" echo "3. Cancel" echo "" read -p "Choose [1-3]: " choice case $choice in 1) wg genkey | tee /tmp/wg-privkey | wg pubkey > /tmp/wg-pubkey echo "" echo "Your public key: $(cat /tmp/wg-pubkey)" echo "Share this with your mesh admin." echo "Private key saved temporarily at /tmp/wg-privkey" echo "" echo "To complete setup, create /etc/wireguard/wg0.conf with:" echo " [Interface]" echo " PrivateKey = $(cat /tmp/wg-privkey)" echo " Address = /24" echo " [Peer]" echo " PublicKey = " echo " Endpoint = :51820" echo " AllowedIPs = 10.66.66.0/24" rm -f /tmp/wg-privkey /tmp/wg-pubkey ;; 2) read -p "Path to WireGuard config file: " cfgpath if [[ -f "$cfgpath" ]]; then sudo cp "$cfgpath" /etc/wireguard/wg0.conf sudo chmod 600 /etc/wireguard/wg0.conf echo "Config imported. Start with: sudo wg-quick up wg0" else echo "File not found: $cfgpath" fi ;; *) echo "Cancelled." ;; esac MESHSCRIPT chmod +x /usr/local/bin/alfred-mesh-setup echo "[Alfred Linux v2.0] Branding and customizations applied successfully."