GUIインストーラCalamaresをカスタマイズしてみました。

Calamares
Calamares
Calamares aims to be easy, usable, beautiful, pragmatic, inclusive and distribution-agnostic

カスタマイズしたCalamaresを組み込んだライブISOイメージで起動し、Arch Linuxをインストールして、Arch Linuxが起動しました。

スクリーンショット

ライブISO起動直後

時刻と天気を自動調整。起動時にミラーリストも更新。

メニュー

ArcMenuの11テーマ

スクリプト

Argosでスクリプト実行(追加/編集可能)

ライブISOで日本語入力

インストーラ


システム情報

ライブISOでの日本語化

ライブISO作成時に初期言語を日本語にすることもできますが、英語版のISOでも日本語に切り替えることができます。
Settings(gnome-control-center) > System > Region & Language > Language で日本語を選択してSelectして、Log Out...

ログインすると日本語環境に切り替わっています。標準フォルダーの名前を日本語化するか確認(xdg-user-dirs-gtk-update)されますが、英語名称のままにすることもできます。

起動画面Plymouth

インストール後

環境

構築

AURにはcalamares 3.3.8とcalamares-git 3.3.14が存在します。最新バージョンであるcalamares-gitの方を利用します。
calamares-gitではAURにあるckbcompが前提パッケージになっています。なお、ckbcompのPKGBUILDに記載されているソースアーカイブのURLがリンク切れの状態なので自動でインストールできません。URLを修正してビルドしてインストールします。

  1. ckbcomp
    paru -G ckbcomp
    cd ckbcomp
    PKGBUILD
    # source=("http://ftp.debian.org/debian/pool/main/c/console-setup/console-setup_${pkgver}.tar.xz")
    source=("https://salsa.debian.org/installer-team/console-setup/-/archive/$pkgver/console-setup-$pkgver.tar.gz")
    makepkg -o --skipchecksums
    makepkg -f -e
    sudo pacman -U ckbcomp-1.234-1-any.pkg.tar.zst
    cp ckbcomp-1.234-1-any.pkg.tar.zst /opt/custom-repo/x86_64/
  2. calamares-git
    paru -S calamares-git
    cp ~/.cache/paru/clone/calamares-git/calamares-git-3.3.14.r25.g95aa33f-1-x86_64.pkg.tar.zst /opt/custom-repo/x86_64/

設定

設定ディレクトリ

以下の優先度で設定ファイルが参照されるようです。

  • /etc/calamares/
  • /usr/share/calamares/

カスタマイズ

  • 設定ファイルのひな型をarchisoのプロジェクトにコピー

    cp -r /usr/share/calamares ./airootfs/etc/
  • calamaresの設定

    ./airootfs/etc/calamares/settings.conf
    ---
    sequence:
    - show:
    - welcome
    - locale
    - keyboard
    - partition
    - users
    - summary
    - exec:
    - partition
    - mount
    - unpackfs
    - machineid
    - locale
    - keyboard
    - localecfg
    - fstab
    - initcpiocfg
    - initcpio
    - removeuser
    - users
    - displaymanager
    - networkcfg
    - hwclock
    - services-systemd
    - packages
    - bootloader
    - umount
    - show:
    - finished

    branding: default
    prompt-install: false
    dont-chroot: false
    oem-setup: false
    quit-at-end: false
  • ようこそ画面

    ./airootfs/etc/calamares/module/welcome.conf
    ---
    showSupportUrl: false
    showKnownIssuesUrl: false
    showReleaseNotesUrl: false
    showDonateUrl: false

    requirements:
    requiredStorage: 5.5
    requiredRam: 1.0
    internetCheckUrl: http://example.com

    check:
    - storage
    - ram
    - power
    - internet
    - root
    - screen

    required:
    - ram

    geoip:
    style: "none"
    url: "https://geoip.kde.org/v1/ubiquity" # extended XML format
    selector: "CountryCode" # blank uses default, which is wrong
  • usersモジュール

    ./airootfs/etc/calamares/modules/users.conf
    allowWeakPasswords: true
    allowWeakPasswordsDefault: true

    弱いパスワードを許容

  • unpackfsモジュール

    ./airootfs/etc/calamares/modules/unpackfs.conf
    unpack:
    - source: "/run/archiso/bootmnt/arch/x86_64/airootfs.sfs"
    sourcefs: "squashfs"
    destination: ""
    - source: "/run/archiso/bootmnt/arch/boot/x86_64/vmlinuz-linux"
    sourcefs: "file"
    destination: "/boot/vmlinuz-linux"
  • ブランディング

    ./airootfs/etc/calamares/branding/branding.desc
    ---
    componentName: default
    welcomeStyleCalamares: false
    welcomeExpandingLogo: true
    windowExpanding: normal
    windowSize: 800px,520px
    windowPlacement: center
    sidebar: widget
    navigation: widget

    strings:
    productName: "${NAME}"
    shortProductName: Arch
    version: Rolling
    shortVersion: Rolling
    versionedName: Arch Linux Rolling
    shortVersionedName: Arch rolling
    bootloaderEntryName: Arch

    images:
    productIcon: "squid.png"
    productLogo: "squid.png"
    productWelcome: "languages.png"

    style:
    SidebarBackground: "#292F34"
    SidebarText: "#FFFFFF"
    SidebarTextCurrent: "#292F34"
    SidebarBackgroundCurrent: "#D35400"

    slideshow: "show.qml"
    slideshowAPI: 2

    uploadServer :
    type : "none"
    url : "http://termbin.com:9999"
    sizeLimit : -1

TODO (対応済)

インストーラ

  • インストール後にライブイメージのユーザliveuserを削除
    ./airootfs/etc/calamares/settings.conf
    sequence:
    -exec:
    - removeuser
    ./airootfs/etc/calamares/modules/removeuser.conf
    username: liveuser
  • インストール後にインストーラを削除
    ./airootfs/etc/calamares/settings.conf
    sequence:
    -exec:
    - packages
    ./airootfs/etc/calamares/modules/packages.conf
    operations:
    - try_remove:
    - calamares-git
    - boostlibs
    - ckbcomp
    - hwinfo
    - kcolorscheme
    - kconfig
    - kcoreaddons
    - ki18n
    - kiconthemes
    - kpmcore
    - polkit-qt6
    - python-jsonschema
    - python-yaml
    - solid
    - squashfs-tools
    - yaml-cpp
    - archiso-calamares-config
  • インストール後に不要となるパッケージの整理
    1. pactree calamares -d 1で依存パッケージを確認
    2. calamares削除後に依存パッケージの削除を試行し、依存関係破壊の有無を確認
    3. pactree -r <package name>で各パッケージに依存しているパッケージを確認
    4. calamaresや削除可能なパッケージにのみ依存関係があるのなら削除可能と判断
      boostlibs ckbcomp hwinfo kcolorscheme kconfig kcoreaddons ki18n kiconthemes kpmcore polkit-qt6 python-jsonschema python-yaml solid squashfs-tools yaml-cpp
  • ブランディングとスライドショー
    https://github.com/calamares/calamares-extensions/tree/calamares/branding/image-slideshow
    ./airootfs/etc/calamares/settings.conf
    branding: fivearch
    ./airootfs/etc/calamares/branding/fivearch/branding.desc
    componentName:  fivearch
    windowExpanding: fullscreen

    Calamaresを最大化して起動

    ./airootfs/etc/calamares/branding/fivearch/ImageSlide.qml
    Item {
    Image {
    id: image
    source: src
    width: parent.width
    height: parent.height
    fillMode: Image.PreserveAspectFit
    anchors.centerIn: parent
    }
    }

    スライドショーの画像をはみ出さない最大のサイズで表示

  • calamares起動時のパスワード入力抑止
    ./airootfs/usr/local/share/applications/calamares.desktop
    exec = sudo -E calamares
  • aboutボタンの背景色の固定
    ./airootfs/etc/calamares/brandings/fivearch/stylesheet.qss
    #aboutButton {
    background-color: #292f34;
    color: #ffffff;
    border: none;
    }

    #aboutButton:pressed {
    background-color: #292f34;
    color: #ffffff;
    border: none;
    }

    #aboutButton:hover {
    background-color: #292f34;
    color: #ffffff;
    border: none;
    }
  • calamares設定ファイルのパッケージ化とアンインストール
    https://aur.archlinux.org/packages/archiso-calamares-config
    /etc/calamares/*
    /usr/local/share/applications/calamares.desktop
    をパッケージ化してカスタムローカルリポジトリに配置
  • plymouth
    https://wiki.archlinux.jp/index.php/Plymouth
    • packages
      ./packages_x86_64
      plymouth
    • mkinitcpio
      ./airootfs/etc/mkinitcpio.conf
      HOOKS=(... udev plymouth ...)
    • grub
      ./airootfs/etc/default/grub
      GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet audit=0 splash"
    • dracut
      ./airootfs/etc/dracut.conf.d/myflags.conf
      add_dracutmodules+=" plymouth "
    • theme: bgrt
      ./airootfs/etc/plymouth/plymouthd.conf
      [Daemon]
      Theme=bgrt

GNOMEデスクトップ環境

  • Wayland対応
    ./airootfs/etc/gdm/custom.conf
    #WaylandEnable=false
    WaylandEnable=true
    WaylandOnByDefault=true
  • 時刻表示を24時間表示に変更
    [org/gnome/desktop/interface]
    clock-format = '24h'
  • タイムゾーンの自動設定
    [org/gnome/desktop/datetime]
    automatic-timezone = true
  • 位置情報の自動収集
    [org/gnome/system/location]
    enabled = true

    動作したけれどプライバシー関連なので要注意

  • インタフェースをライト系に設定
    [org/gnome/desktop/interface]
    color-scheme = 'default'
    cursor-theme = 'Fluent-dark-cursors'
    gtk-theme = 'Fluent-round-Light'
    icon-theme = 'Fluent-light'
  • GDMログイン画面のカスタマイズ
    画面解像度が低いと標準のArch Linuxのロゴ画像とGUI部品が重なるので横長のロゴ画像に差し替え
    /etc/dconf/db/gdm.d/01-logo
    [org/gnome/login-screen]
    #logo='/usr/share/pixmaps/archlinux-logo.png'
    logo='/usr/share/pixmaps/archlinux-logo-text.svg'

GNOME Shell拡張機能

  • 導入手段
    手段 概要
    ローカル ホームディレクトリ配下にファイルでインストールする。自動でバージョンアップされて再ログインの際に反映される?
    AURパッケージ AUR版は最新版よりバージョンが古い場合がある。
    AUR-gitパッケージ ソースからビルドするのでバージョンは最新になる。AURパッケージとしてのバージョンが更新されない場合、パッケージ最新化では本体がアップデートされない?
  • 導入状況
    $ gnome-extensions list --enabled | sort
    arcmenu@arcmenu.com
    argos@pew.worldwidemann.com
    blur-my-shell@aunetx
    caffeine@patapon.info
    dash-to-panel@jderose9.github.com
    ding@rastersoft.com
    forge@jmmaranan.com
    kimpanel@kde.org
    openweather-extension@penguin-teal.github.io
    user-theme@gnome-shell-extensions.gcampax.github.com

    ライブISOではblur-my-shell、forgeを初期無効化

  • Arc Menu
    https://archlinux.org/packages/extra/any/gnome-shell-extension-arc-menu-git/

    gnome-shell-extension-arc-menuが古いのでgnome-shell-extension-arc-menu-gitをビルド

  • Argos
    https://aur.archlinux.org/packages/gnome-shell-extension-argos-git
    paru btop fastfetch reflector journalctlのランチャーを追加
    extension.js
    let scriptContents =
    '#!/usr/bin/env bash\n\n' +
    'URL="github.com/p-e-w/argos"\n' +
    'DIR=$(dirname "$0")\n\n' +
    'echo " | iconName=dialog-information-symbolic"\n' +
    'echo "---"\n' +
    'echo "$URL | iconName=help-faq-symbolic href=\'https://$URL\'"\n' +
    'echo "$DIR | iconName=folder-symbolic href=\'file://$DIR\'"\n\n' +
    'echo "Update Packages (<span color=\'yellow\'><tt>paru</tt></span>) | iconName=software-update-available-symbolic bash=\'paru; pacman -Qdtq | sudo pacman -Rs -; exit\'"\n' +
    'echo "Resource Monitor (<span color=\'yellow\'><tt>btop</tt></span>) | iconName=utilities-system-monitor bash=\'btop; exit\'"\n' +
    'echo "System Information (<span color=\'yellow\'><tt>fastfetch</tt></span>) | iconName=dialog-information bash=\'fastfetch; read; exit\'"\n' +
    'echo "Update Millorlist (<span color=\'yellow\'><tt>reflector</tt></span>) | iconName=system-component-input-sources bash=\'sudo systemctl start reflector.service; cat /etc/pacman.d/mirrorlist\'"\n' +
    'echo "System Log (<span color=\'yellow\'><tt>journalctl</tt></span>) | iconName=text-x-log bash=\'journalctl -rp err -b; exit\'"\n' +
    'echo "Fish Shell | iconName=utilities-terminal-symbolic"\n' +
    'echo "--Enable | iconName=media-playback-start-symbolic bash=\'sed -i s/FISH_ENABLED=0/FISH_ENABLED=1/ ~/.bashrc\' terminal=\'false\'"\n' +
    'echo "--Disable | iconName=media-playback-stop-symbolic bash=\'sed -i s/FISH_ENABLED=1/FISH_ENABLED=0/ ~/.bashrc\' terminal=\'false\'"';
  • Blur My Shell
    https://aur.archlinux.org/packages/gnome-shell-extension-blur-my-shell
  • Caffeine
    https://archlinux.org/packages/extra/any/gnome-shell-extension-caffeine/
  • Dash to Panel
    https://archlinux.org/packages/extra/any/gnome-shell-extension-dash-to-panel/
    [org/gnome/shell/extensions/dash-to-panel]
    panel-element-positions='{"0":[{"element":"showAppsButton","visible":false,"position":"stackedTL"},{"element":"activitiesButton","visible":false,"position":"stackedTL"},{"element":"leftBox","visible":true,"position":"stackedTL"},{"element":"centerBox","visible":true,"position":"stackedBR"},{"element":"taskbar","visible":true,"position":"centerMonitor"},{"element":"rightBox","visible":true,"position":"stackedBR"},{"element":"systemMenu","visible":true,"position":"stackedBR"},{"element":"dateMenu","visible":true,"position":"stackedBR"},{"element":"desktopButton","visible":true,"position":"stackedBR"}],"DEL-402HR7B310VL":[{"element":"showAppsButton","visible":false,"position":"stackedTL"},{"element":"activitiesButton","visible":false,"position":"stackedTL"},{"element":"leftBox","visible":true,"position":"stackedTL"},{"element":"centerBox","visible":true,"position":"stackedBR"},{"element":"taskbar","visible":true,"position":"centerMonitor"},{"element":"rightBox","visible":true,"position":"stackedBR"},{"element":"systemMenu","visible":true,"position":"stackedBR"},{"element":"dateMenu","visible":true,"position":"stackedBR"},{"element":"desktopButton","visible":true,"position":"stackedBR"}]}'

    初期設定はモニタ”0”を指定

  • Desktop Icons NG
    https://archlinux.org/packages/extra/any/gnome-shell-extension-desktop-icons-ng/
  • Forge
    https://aur.archlinux.org/packages/gnome-shell-extension-forge
  • Input Method Panel
    https://aur.archlinux.org/packages/gnome-shell-extension-kimpanel-git
  • OpenWeatherRefind
    https://aur.archlinux.org/packages/gnome-shell-extension-openweatherrefined

    GNOME Shell 48を追加

  • User Theme
    GNOME Shellテーマをダーク系に設定
    [org/gnome/shell/extensions/user-theme]
    name='Fluent-round-Dark'

パッケージ

  • btop
  • chromium
    ~/.config/chromium-flags.conf
    --password-store=basic
    --enable-features=UseOzonePlatform
    --ozone-platform=wayland
    --enable-wayland-ime

    GNOMEのデフォルトのパスワードストアはgnome-libsecret。初回起動時にパスワードを聞かれてしまう。basicで回避

  • fastfetch
    カスタムテーマ
    ~/.config/fastfetch/config.jsonc
  • fcitx5 fcitx5-im fcitx5-mozc
    かな漢字変換
  • fish
    fishの設定、aliasの追加
    ~/.config/fish/config.fish
    ./airootfs/etc/skel/.bashrc
    export FISH_ENABLED=0
    if [[ $FISH_ENABLED == 1 && $(ps --no-header --pid=$PPID --format=comm) != "fish" && -z ${BASH_EXECUTION_STRING} ]]
    then
    shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=''
    exec fish $LOGIN_OPTION
    fi
  • gnome-terminal
    ダーク系に設定
    [org/gnome/terminal/legacy]
    theme-variant = 'dark'
  • nautilusのアイコンサイズ変更
    [org/gnome/nautilus/icon-view]
    default-zoom-level = 'small-plus'
  • nvidia nvidia-utils nvidia-settings
  • reflector
    サービスによる定期自動ミラーリスト更新設定を有効化
  • starship
    カスタムテーマ
    ~/.config/starship.toml
  • spice-vdagent
    GNOME Boxes(QEMU)でクリップボード共有
    https://wiki.archlinux.org/title/QEMU#Enabling_SPICE_support_on_the_guest
  • paru
    ./airootfs/etc/skel/.config/paru/paru.conf
    [options]
    SudoLoop
    SkipReview
  • makepkg
    ./airootfs/etc/skel/.makepkg.conf
    MAKEFLAGS="-j $(nproc)"
  • vi
    ./airootfs/etc/skel/.exrc
    set showmode
    set number
    set ruler
    set title
    set showcmd
  • archinstall
    日本語ターミナル環境で実行できて便利かもしれない。

日本語環境

  • ライブイメージ起動時の言語を指定する場合
    ./airootfs/etc/locale.conf
    #LANG=en_US.UTF-8
    LANG=ja_JP.UTF-8
  • 日本語ロケール追加
    ./airootfs/etc/locale.gen
    en_US.UTF-8 UTF-8
    ja_JP.UTF-8 UTF-8
  • 日本語入力を追加、有効化
    ライブイメージ起動直後からかな漢字変換が利用できるようになった
  • GNOME/Wayland 上での Fcitx の利用
    /etc/environment
    XMODIFIERS=@im=fcitx

ハードウェア

  • Wi-Fi接続 : OK
  • Bluetooth接続 : OK

TODO (これから)

動作確認

  • VirtualBox : OK
  • Gnome Boxes (qemu/KVM/livirt) : OK
  • VMWare : 未テスト
  • Hyper-V (第一世代/第二世代) : 未テスト
  • 物理環境 : 未テスト
  • Secure boot環境での挙動把握

チューニング

  • ISOイメージサイズと展開時間のチューニング
    squashfs : xz / gzip / lzo
  • インストール済のパッケージのサイズ確認
    pacman -Qqe > installed_packages.txt
    while read -r package; do
    du -sh "/var/cache/pacman/pkg/$package-"*".pkg.tar.zst"
    done < installed_packages.txt > package_sizes.txt

追加設定、施策

  • githubに登録
    https://github.com/ktkr3d/archiso-gnome
    https://github.com/ktkr3d/archiso-calamares-config
  • デフォルトターミナルエミュレータの設定
    gnome-terminalが依存され過ぎて削除できない
  • フォント指定
    [org/gnome/desktop/interface]
    font-name 'Noto Sans CJK JP 11'
    document-font-name 'Noto Sans CJK JP 11'
    monospace-font-name = 'HackGen Console NF 11'
  • paruキャッシュとカスタムローカルリポジトリの連動
    paru
    find ~/.cache/paru/clone/ -name "*.pkg.tar.zst"
  • xorgの削除
    xorg-serverを削除しても特に依存関係は崩れなかった
  • colord
    起動時にcolordがcore dumpする。その後正常にcolordサービスは実行されている。
    https://archlinux.org/packages/extra/x86_64/colord/
  • カーネルパラメタ
  • CalamaresのWelcome画面の言語一覧に日本語が2つ存在するのはなぜ?

TODO (多分やらない)

  • chromium → Google Chrome
    なんとなくデフォルトはOSSで揃えておきたいので保留。
  • nautilusのブックマークに/を追加
    ~/.config/gtk-3.0/bookmarks
    スクリプト等での追加が必要そうなので保留。
  • pamac追加
    基本的にパッケージはコマンドで入れるので保留。
  • 日本語ロケールでもホームフォルダの各ディレクトリ名を英語のままに
    .config/user-dirs.dirs
    .config/user-dirs.locale
    /etc/xdg/user-dirs.defaults
    従来通りLANG=C xdg-user-dirs-gtk-updateで実現できるので保留。
  • fcitx5-diagnose対策(ログイン時のポップアップ抑止)
    https://github.com/fcitx/fcitx5/issues/1088#issuecomment-2261538744
    ログイン後fcitx5 -rでポップアップが表示されないことから、fcitx開始から7秒以内にKimpanelのプロセスが生成されていないんだろうなぁ。
    $ fcitx5-diagnose
    4. User Interface:

    Found 3 enabled user interface addons:

    Classic User Interface
    KDE Input Method Panel
    DBus Virtual Keyboard

    Kimpanel process:

    6097 /usr/bin/gnome-shell
    メンテナが対応してくれるかもしれないので保留。