Skip to content

Commit c6d59a5

Browse files
committed
feat(installer): add Runit support and Void Linux build from source
- Add Runit as init system option alongside systemd and OpenRC - Add Void Linux distro with Source build instructions using xbps - Add user/group creation step for non-systemd installations - Add udev reload and uinput modprobe steps for Source builds - Add per-user service commands for OpenRC and Runit (Void/Artix paths) - Add DBUS_SESSION_BUS_ADDRESS note for non-systemd environments
1 parent df3a6fd commit c6d59a5

3 files changed

Lines changed: 129 additions & 16 deletions

File tree

src/components/InteractiveInstaller.vue

Lines changed: 104 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import {
1212
logic,
1313
fcitx5Config,
1414
kanataConfig,
15+
userCreationCmd,
16+
udevReloadCmd,
17+
uinputModprobeCmd,
1518
} from '@/data/installer';
1619
1720
const selectedDistro = ref(distros[0]?.name || '');
@@ -21,10 +24,26 @@ const selectedDe = ref<string>(deWms[0] || '');
2124
const selectedEnv = ref<string>(environments[1] || '');
2225
const selectedInit = ref<string>(initSystems[0] || 'systemd');
2326
27+
const needsUserCreation = computed(() => {
28+
return selectedInit.value !== 'systemd' || selectedMethod.value === 'Source';
29+
});
30+
31+
const needsUdevReload = computed(() => {
32+
return selectedMethod.value === 'Source';
33+
});
34+
35+
const needsUinputModprobe = computed(() => {
36+
return selectedMethod.value === 'Source';
37+
});
38+
2439
const activateServerCode = computed(() => {
2540
if (selectedDistro.value === 'NixOS')
2641
return '# Bước này đã được cấu hình trong flake.nix ở trên.';
27-
if (isAutoHandled.value && selectedInit.value !== 'OpenRC') {
42+
if (
43+
isAutoHandled.value &&
44+
selectedInit.value !== 'OpenRC' &&
45+
selectedInit.value !== 'runit'
46+
) {
2847
return '# Gói .deb sẽ tự động thực hiện bước này.\n' + serverCmd.value;
2948
}
3049
return serverCmd.value;
@@ -38,7 +57,13 @@ const shellConfigCode = computed(() => {
3857
3958
const serverCmd = computed(() => {
4059
if (selectedInit.value === 'OpenRC') {
41-
return 'sudo rc-update add fcitx5-lotus\nsudo ln -s /etc/init.d/fcitx5-lotus /etc/init.d/fcitx5-lotus.$(whoami)\nsudo rc-service fcitx5-lotus.$(whoami) restart';
60+
return 'sudo ln -s /etc/init.d/fcitx5-lotus /etc/init.d/fcitx5-lotus.$(whoami)\nsudo rc-update add fcitx5-lotus.$(whoami) default\nsudo rc-service fcitx5-lotus.$(whoami) restart';
61+
}
62+
if (selectedInit.value === 'runit') {
63+
if (selectedDistro.value === 'Void Linux') {
64+
return 'sudo ln -s /etc/sv/fcitx5-lotus /var/service/fcitx5-lotus.$(whoami)\nsudo sv start fcitx5-lotus.$(whoami)';
65+
}
66+
return 'sudo ln -sf /etc/runit/sv/fcitx5-lotus /etc/runit/sv/fcitx5-lotus.$(whoami)\nsudo sv start /etc/runit/sv/fcitx5-lotus.$(whoami)';
4267
}
4368
if (selectedShell.value === 'Fish')
4469
return 'sudo systemctl enable --now fcitx5-lotus-server@(whoami).service; or begin; sudo systemd-sysusers; and sudo systemctl enable --now fcitx5-lotus-server@(whoami).service; end';
@@ -78,7 +103,6 @@ const envCmd = computed(() => {
78103
} else if (selectedShell.value === 'Zsh') {
79104
return `cat <<EOF >> ~/.zprofile\n${vars.join('\n')}\nEOF`;
80105
} else {
81-
// Fish
82106
const fishVars = vars.map((v) => {
83107
const idxEq = v.indexOf('=');
84108
const name = v.slice(0, idxEq).replace('export ', '');
@@ -123,7 +147,6 @@ const autostartText = computed(
123147
],
124148
);
125149
126-
// Wayland Logic
127150
const waylandGeneral = computed(() => {
128151
if (selectedEnv.value !== 'Wayland') return null;
129152
return logic.steps.wayland_extras.General;
@@ -137,7 +160,7 @@ const waylandDeSpecific = computed(() => {
137160
const chromiumWaylandFlags = computed(() =>
138161
selectedDe.value === 'KDE Plasma'
139162
? '--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime'
140-
: '--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime --wayland-text-input-version=3'
163+
: '--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime --wayland-text-input-version=3',
141164
);
142165
</script>
143166

@@ -254,11 +277,58 @@ const chromiumWaylandFlags = computed(() =>
254277
</div>
255278
</div>
256279

280+
<div v-if="needsUserCreation" class="step-card">
281+
<div class="step-badge">1.5</div>
282+
<div class="step-content">
283+
<h4>Tạo User và Group (thay thế systemd-sysusers)</h4>
284+
<p class="instruction">
285+
Non-systemd và build from source cần tạo user
286+
<code>uinput_proxy</code> và group <code>input</code> thủ công.
287+
</p>
288+
<div class="code-container">
289+
<pre><code>{{ userCreationCmd }}</code></pre>
290+
<el-button
291+
class="copy-float"
292+
circle
293+
:icon="DocumentCopy"
294+
@click="copyToClipboard(userCreationCmd)"
295+
/>
296+
</div>
297+
</div>
298+
</div>
299+
300+
<div v-if="needsUdevReload" class="step-card">
301+
<div class="step-badge">1.6</div>
302+
<div class="step-content">
303+
<h4>Reload Udev Rules</h4>
304+
<p class="instruction">
305+
Áp dụng các udev rules mới (99-lotus.rules) để thiết bị uinput có
306+
quyền đúng.
307+
</p>
308+
<div class="code-container">
309+
<pre><code>{{ udevReloadCmd }}</code></pre>
310+
<el-button
311+
class="copy-float"
312+
circle
313+
:icon="DocumentCopy"
314+
@click="copyToClipboard(udevReloadCmd)"
315+
/>
316+
</div>
317+
</div>
318+
</div>
319+
257320
<div class="step-card">
258321
<div class="step-badge">2</div>
259322
<div class="step-content">
260323
<h4>Kích hoạt Server</h4>
261-
<div v-if="isAutoHandled && selectedInit !== 'OpenRC'" class="mb-3">
324+
<div
325+
v-if="
326+
isAutoHandled &&
327+
selectedInit !== 'OpenRC' &&
328+
selectedInit !== 'runit'
329+
"
330+
class="mb-3"
331+
>
262332
<el-alert
263333
title="Gói .deb sẽ tự động kích hoạt server qua post-install script. Bạn có thể bỏ qua bước này."
264334
type="success"
@@ -277,6 +347,26 @@ const chromiumWaylandFlags = computed(() =>
277347
</div>
278348
</div>
279349

350+
<div v-if="needsUinputModprobe" class="step-card">
351+
<div class="step-badge">2.5</div>
352+
<div class="step-content">
353+
<h4>Nạp Kernel Module uinput</h4>
354+
<p class="instruction">
355+
Module uinput cần được nạp lần để fcitx5-lotus-server có thể tạo
356+
thiết bị input ảo, lần sau khởi động sẽ tự động nạp.
357+
</p>
358+
<div class="code-container">
359+
<pre><code>{{ uinputModprobeCmd }}</code></pre>
360+
<el-button
361+
class="copy-float"
362+
circle
363+
:icon="DocumentCopy"
364+
@click="copyToClipboard(uinputModprobeCmd)"
365+
/>
366+
</div>
367+
</div>
368+
</div>
369+
280370
<div class="step-card">
281371
<div class="step-badge">3</div>
282372
<div class="step-content">
@@ -420,11 +510,15 @@ const chromiumWaylandFlags = computed(() =>
420510
</div>
421511
</div>
422512

423-
<div v-if="selectedInit === 'OpenRC'" class="extra-item mb-4">
513+
<div
514+
v-if="selectedInit === 'OpenRC' || selectedInit === 'runit'"
515+
class="extra-item mb-4"
516+
>
424517
<p class="instruction">
425-
<b>Lưu ý cho OpenRC:</b> Thêm biến sau vào cấu hình môi trường
426-
(ví dụ <code>/etc/environment</code> hoặc config của DE/WM) để
427-
fix lỗi không gõ được trên các ứng dụng X11/XCB:
518+
<b>Lưu ý cho {{ selectedInit }}:</b> Thêm biến sau vào cấu
519+
hình môi trường (ví dụ <code>/etc/environment</code> hoặc
520+
config của DE/WM) để fix lỗi không gõ được trên các ứng dụng
521+
X11/XCB:
428522
</p>
429523
<div class="code-container mini">
430524
<pre><code>DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus</code></pre>

src/data/installer.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const distros = [
55
{ name: 'Arch Linux', icon: 'si-archlinux' },
66
{ name: 'openSUSE', icon: 'si-opensuse' },
77
{ name: 'NixOS', icon: 'si-nixos' },
8+
{ name: 'Void Linux', icon: 'co-linux' },
89
];
910

1011
export const methods = ['Package Manager', 'Binary', 'Source'];
@@ -24,7 +25,7 @@ export const deWms = [
2425
'Hyprland',
2526
];
2627
export const environments = ['X11', 'Wayland'];
27-
export const initSystems = ['systemd', 'OpenRC'];
28+
export const initSystems = ['systemd', 'OpenRC', 'runit'];
2829

2930
export const logic = {
3031
steps: {
@@ -39,35 +40,43 @@ export const logic = {
3940
"CODENAME=$(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)\nsudo mkdir -p /etc/apt/keyrings\ncurl -fsSL https://fcitx5-lotus.pages.dev/pubkey.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/fcitx5-lotus.gpg\necho \"deb [signed-by=/etc/apt/keyrings/fcitx5-lotus.gpg] https://fcitx5-lotus.pages.dev/apt/$CODENAME $CODENAME main\" | sudo tee /etc/apt/sources.list.d/fcitx5-lotus.list\nsudo apt update && sudo apt install fcitx5-lotus",
4041
Binary: 'sudo dpkg -i fcitx5-lotus_*.deb',
4142
Source:
42-
'sudo apt-get install cmake extra-cmake-modules libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev libinput-dev libudev-dev g++ golang hicolor-icon-theme pkg-config libx11-dev libfcitx5-qt6-dev qt6-base-dev fcitx5-modules-dev\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .\nmake\nsudo make install',
43+
'sudo apt-get install cmake extra-cmake-modules libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev libinput-dev libudev-dev g++ golang hicolor-icon-theme pkg-config libx11-dev fcitx5-modules-dev python3\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .\nmake\nsudo make install',
4344
},
4445
Ubuntu: {
4546
'Package Manager':
4647
"CODENAME=$(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d'=' -f2)\nsudo mkdir -p /etc/apt/keyrings\ncurl -fsSL https://fcitx5-lotus.pages.dev/pubkey.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/fcitx5-lotus.gpg\necho \"deb [signed-by=/etc/apt/keyrings/fcitx5-lotus.gpg] https://fcitx5-lotus.pages.dev/apt/$CODENAME $CODENAME main\" | sudo tee /etc/apt/sources.list.d/fcitx5-lotus.list\nsudo apt update && sudo apt install fcitx5-lotus",
4748
Binary: 'sudo dpkg -i fcitx5-lotus_*.deb',
4849
Source:
49-
'sudo apt-get install cmake extra-cmake-modules libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev libinput-dev libudev-dev g++ golang hicolor-icon-theme pkg-config libx11-dev libfcitx5-qt6-dev qt6-base-dev fcitx5-modules-dev\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .\nmake\nsudo make install',
50+
'sudo apt-get install cmake extra-cmake-modules libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev libinput-dev libudev-dev g++ golang hicolor-icon-theme pkg-config libx11-dev fcitx5-modules-dev python3\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .\nmake\nsudo make install',
5051
},
5152
Fedora: {
5253
'Package Manager':
5354
"RELEASEVER=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2)\nsudo rpm --import https://fcitx5-lotus.pages.dev/pubkey.gpg\nsudo dnf config-manager addrepo --from-repofile=https://fcitx5-lotus.pages.dev/rpm/fedora/fcitx5-lotus-$RELEASEVER.repo\nsudo dnf install fcitx5-lotus",
5455
Binary: 'sudo rpm -i fcitx5-lotus-*.rpm',
5556
Source:
56-
'sudo dnf install cmake extra-cmake-modules fcitx5-devel libinput-devel libudev-devel gcc-c++ golang hicolor-icon-theme systemd-devel libX11-devel fcitx5-qt-devel\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .\nmake\nsudo make install',
57+
'sudo dnf install cmake extra-cmake-modules fcitx5-devel libinput-devel libudev-devel gcc-c++ golang hicolor-icon-theme systemd-devel libX11-devel python3\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .\nmake\nsudo make install',
5758
},
5859
openSUSE: {
5960
'Package Manager':
6061
'sudo rpm --import https://fcitx5-lotus.pages.dev/pubkey.gpg\nsudo zypper addrepo https://fcitx5-lotus.pages.dev/rpm/opensuse/fcitx5-lotus-tumbleweed.repo\nsudo zypper refresh\nsudo zypper install fcitx5-lotus',
6162
Binary: 'sudo rpm -i fcitx5-lotus-*.rpm',
6263
Source:
63-
'sudo zypper install cmake extra-cmake-modules fcitx5-devel libinput-devel systemd-devel gcc-c++ go hicolor-icon-theme systemd-devel libX11-devel udev fcitx5-qt-devel\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .\nmake\nsudo make install',
64+
'sudo zypper install cmake extra-cmake-modules fcitx5-devel libinput-devel systemd-devel gcc-c++ go hicolor-icon-theme systemd-devel libX11-devel udev python3\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib .\nmake\nsudo make install',
6465
},
6566
NixOS: {
6667
'Package Manager':
67-
'# Thêm input của fcitx5-lotus vào flake.nix:\n{\n inputs = {\n nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";\n\n fcitx5-lotus = {\n url = "github:LotusInputMethod/fcitx5-lotus";\n inputs.nixpkgs.follows = "nixpkgs";\n };\n };\n\n outputs = {\n self,\n ...\n}\n\n# Bật fcitx5-lotus service trong configuration.nix:\n\n{\n inputs,\n ...\n}: {\n imports = [\n inputs.fcitx5-lotus.nixosModules.fcitx5-lotus\n ];\n\n services.fcitx5-lotus = {\n enable = true;\n user = "your_username"; # Sửa thành tên user của bạn\n };\n}\n\n# Rebuild lại system để cài đặt.',
68+
'# Thêm input của fcitx5-lotus vào flake.nix:\n{\n inputs = {\n nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";\n\n fcitx5-lotus = {\n url = "github:LotusInputMethod/fcitx5-lotus";\n inputs.nixpkgs.follows = "nixpkgs";\n };\n };\n\n outputs = {\n self,\n ...\n}\n\n# Bật fcitx5-lotus service trong configuration.nix:\n\n{\n inputs,\n ...\n}: {\n imports = [\n inputs.fcitx5-lotus.nixosModules.fcitx5-lotus\n ];\n\n services.fcitx5-lotus = {\n enable = true;\n user = "your_username"; # Sửa thành tên user của bạn\n\n };\n}\n\n# Rebuild lại system để cài đặt.',
6869
Binary: 'NixOS ưu tiên cấu hình thông qua flake hoặc module.',
6970
Source: 'NixOS ưu tiên sử dụng nix-shell.',
7071
},
72+
'Void Linux': {
73+
'Package Manager':
74+
'Void Linux sử dụng xbps. Hiện chưa có gói chính thức, vui lòng build from source.',
75+
Binary:
76+
'Void Linux sử dụng xbps. Hiện chưa có gói chính thức, vui lòng build from source.',
77+
Source:
78+
'sudo xbps-install -S cmake extra-cmake-modules libfcitx5-devel libinput-devel eudev-libudev-devel gcc go gettext-devel pkg-config hicolor-icon-theme libx11-devel\n\ngit clone https://github.com/LotusInputMethod/fcitx5-lotus.git\ncd fcitx5-lotus\nmkdir build && cd build\ncmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/usr/lib -DINSTALL_RUNIT=ON -DRUNIT_SV_DIR=/etc/sv ..\nmake\nsudo make install',
79+
},
7180
},
7281
autostart: {
7382
GNOME: 'GNOME Tweaks → Startup Applications → Add → Fcitx 5',
@@ -119,6 +128,14 @@ export const logic = {
119128
},
120129
};
121130

131+
export const userCreationCmd =
132+
'sudo groupadd -f input\nsudo useradd -M -g input -s /usr/bin/nologin -d / uinput_proxy';
133+
134+
export const udevReloadCmd =
135+
'sudo udevadm control --reload-rules\nsudo udevadm trigger';
136+
137+
export const uinputModprobeCmd = 'sudo modprobe uinput';
138+
122139
export const fcitx5Config = {
123140
steps: [
124141
'Mở <b>Fcitx5 Configuration</b> (tìm trong menu hoặc chạy <code>fcitx5-configtool</code>).',

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
SiFedora,
1313
SiOpensuse,
1414
SiNixos,
15+
CoLinux,
1516
HiStar,
1617
HiUsers,
1718
HiTag,
@@ -26,6 +27,7 @@ addIcons(
2627
SiFedora,
2728
SiOpensuse,
2829
SiNixos,
30+
CoLinux,
2931
HiStar,
3032
HiUsers,
3133
HiTag,

0 commit comments

Comments
 (0)