Skip to content

Commit ce0dc4c

Browse files
refactor: Use msg_* helpers consistently
Replace echo with emoji (❌, ⚠️, ✓) with msg_* functions. Added msg_* to omarchy-looking-glass-install.
1 parent c348339 commit ce0dc4c

File tree

5 files changed

+149
-133
lines changed

5 files changed

+149
-133
lines changed

bin/omarchy-gpu-passthrough-info

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ verify_setup() {
282282
msg_success "Status: Ready for GPU passthrough! ✓"
283283
echo ""
284284
echo "GPU passthrough is properly configured:"
285-
echo "$vfio_gpus GPU(s) bound to vfio-pci"
286-
echo "IOMMU enabled and configured"
287-
echo "Kernel parameters active"
285+
msg_success "$vfio_gpus GPU(s) bound to vfio-pci"
286+
msg_success "IOMMU enabled and configured"
287+
msg_success "Kernel parameters active"
288288
elif [[ "$total_errors" -eq 0 ]] && [[ "$vfio_gpus" -eq 0 ]]; then
289289
# Detect current GPU mode (dynamic binding design supports 3 states)
290290
local gpu_mode="unknown"
@@ -298,8 +298,8 @@ verify_setup() {
298298
msg_success "Status: GPU in boot state (dynamic binding) ✓"
299299
echo ""
300300
echo "GPU is blacklisted and inactive (by design)."
301-
echo "IOMMU enabled and configured"
302-
echo "Kernel parameters active"
301+
msg_success "IOMMU enabled and configured"
302+
msg_success "Kernel parameters active"
303303
echo ""
304304
echo "To use GPU:"
305305
echo " • For VM: omarchy-gpu-passthrough mode vm"
@@ -309,8 +309,8 @@ verify_setup() {
309309
msg_success "Status: GPU bound to native driver ✓"
310310
echo ""
311311
echo "GPU is available for host use (CUDA/compute)."
312-
echo "IOMMU enabled and configured"
313-
echo "GPU bound to native driver"
312+
msg_success "IOMMU enabled and configured"
313+
msg_success "GPU bound to native driver"
314314
echo ""
315315
echo "To use GPU in VM:"
316316
echo " • Run: omarchy-gpu-passthrough mode vm"

bin/omarchy-gpu-passthrough-setup

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ check_passthrough_feasibility() {
640640
msg_warn "GPU passthrough requires bare metal (physical hardware)"
641641
echo ""
642642
echo "This tool is for:"
643-
echo "Physical Omarchy installations (bare metal)"
643+
msg_success "Physical Omarchy installations (bare metal)"
644644
echo " ✗ NOT for Omarchy running inside a VM"
645645
echo ""
646646
echo "If you want to use GPU inside a VM:"
@@ -1355,9 +1355,9 @@ cmd_uninstall() {
13551355
msg_warn "REBOOT REQUIRED"
13561356
echo ""
13571357
echo "After reboot:"
1358-
echo "Your GPU will be available to Linux"
1359-
echo "GPU drivers (nvidia/amdgpu) will load normally"
1360-
echo "You can use your GPU for gaming, rendering, etc."
1358+
msg_success "Your GPU will be available to Linux"
1359+
msg_success "GPU drivers (nvidia/amdgpu) will load normally"
1360+
msg_success "You can use your GPU for gaming, rendering, etc."
13611361
echo ""
13621362
msg_info "To reboot now: sudo reboot"
13631363
}

bin/omarchy-looking-glass-install

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,96 +7,112 @@ ORIGINAL_SCRIPT_ARGS=("$@")
77
SPICE_DIR="/var/run/omarchy-windows" # SPICE socket directory (tmpfs, auto-cleaned on reboot)
88
SPICE_SOCKET_PATH="$SPICE_DIR/spice.sock" # SPICE Unix socket
99

10+
msg_error() {
11+
echo "❌ Error: $*"
12+
}
13+
14+
msg_warning() {
15+
echo "⚠️ Warning: $*"
16+
}
17+
18+
msg_success() {
19+
echo "$*"
20+
}
21+
22+
msg_info() {
23+
echo "ℹ️ $*"
24+
}
25+
1026
echo "Installing Looking Glass B7..."
1127
echo "Ultra-low latency VM display as an alternative to RDP."
1228
echo ""
1329

1430
# Request sudo access upfront (avoids password prompt during compilation)
1531
if ! sudo -v 2>/dev/null; then
16-
echo "sudo access required for installation"
32+
msg_error "sudo access required for installation"
1733
exit 1
1834
fi
1935

2036
# Install kernel headers (required for DKMS)
21-
echo "Installing kernel headers..."
37+
msg_info "Installing kernel headers..."
2238
KERNEL=$(uname -r)
2339

2440
# Validate kernel modules directory exists
2541
if [[ ! -d "/lib/modules/$KERNEL" ]]; then
26-
echo "⚠️ Kernel modules directory not found, using default kernel package"
42+
msg_warning "Kernel modules directory not found, using default kernel package"
2743
KERNEL_PACKAGE="linux"
2844
else
2945
KERNEL_PACKAGE=$(pacman -Qo "/lib/modules/$KERNEL" 2>/dev/null | sed -n 's/.* is owned by \([^ ]*\) .*/\1/p' | head -1)
3046

3147
if [[ -z "$KERNEL_PACKAGE" ]]; then
32-
echo "⚠️ Could not detect kernel package, defaulting to linux"
48+
msg_warning "Could not detect kernel package, defaulting to linux"
3349
KERNEL_PACKAGE="linux"
3450
fi
3551
fi
3652

3753
if [[ "$KERNEL_PACKAGE" == "linux" ]]; then
3854
if ! omarchy-pkg-add linux-headers; then
39-
echo "Failed to install linux-headers"
55+
msg_error "Failed to install linux-headers"
4056
exit 1
4157
fi
4258
elif [[ "$KERNEL_PACKAGE" == "linux-lts" ]]; then
4359
if ! omarchy-pkg-add linux-lts-headers; then
44-
echo "Failed to install linux-lts-headers"
60+
msg_error "Failed to install linux-lts-headers"
4561
exit 1
4662
fi
4763
elif [[ "$KERNEL_PACKAGE" == "linux-zen" ]]; then
4864
if ! omarchy-pkg-add linux-zen-headers; then
49-
echo "Failed to install linux-zen-headers"
65+
msg_error "Failed to install linux-zen-headers"
5066
exit 1
5167
fi
5268
else
53-
echo "⚠️ Unknown kernel package: $KERNEL_PACKAGE, installing linux-headers"
69+
msg_warning "Unknown kernel package: $KERNEL_PACKAGE, installing linux-headers"
5470
if ! omarchy-pkg-add linux-headers; then
55-
echo "Failed to install linux-headers"
71+
msg_error "Failed to install linux-headers"
5672
exit 1
5773
fi
5874
fi
59-
echo "Kernel headers installed"
75+
msg_success "Kernel headers installed"
6076

6177
# Install packages from AUR (yay is pre-installed in Omarchy)
6278
if pacman -Q looking-glass looking-glass-module-dkms &>/dev/null; then
63-
echo "Looking Glass packages already installed"
79+
msg_success "Looking Glass packages already installed"
6480
else
65-
echo "Installing packages (looking-glass, looking-glass-module-dkms)..."
81+
msg_info "Installing packages (looking-glass, looking-glass-module-dkms)..."
6682
echo " This may take a few minutes (downloading and compiling)..."
6783
echo ""
6884
if ! yay -S --noconfirm --needed looking-glass looking-glass-module-dkms; then
6985
echo ""
70-
echo "Failed to install Looking Glass packages"
86+
msg_error "Failed to install Looking Glass packages"
7187
echo " Please check the errors above and try again"
7288
exit 1
7389
fi
7490
echo ""
75-
echo "Packages installed"
91+
msg_success "Packages installed"
7692
fi
7793

7894
# Configure udev rules
79-
echo "Configuring udev rules..."
95+
msg_info "Configuring udev rules..."
8096
sudo tee /etc/udev/rules.d/99-kvmfr.rules >/dev/null <<'EOF'
8197
SUBSYSTEM=="kvmfr", OWNER="root", GROUP="kvm", MODE="0660"
8298
EOF
8399

84100
if ! sudo udevadm control --reload-rules 2>/dev/null; then
85-
echo "⚠️ Failed to reload udev rules (non-fatal)"
101+
msg_warning "Failed to reload udev rules (non-fatal)"
86102
fi
87103

88104
if ! sudo udevadm trigger 2>/dev/null; then
89-
echo "⚠️ Failed to trigger udev (non-fatal)"
105+
msg_warning "Failed to trigger udev (non-fatal)"
90106
fi
91107

92-
echo "Udev rules configured"
108+
msg_success "Udev rules configured"
93109

94110
# Configure kernel module size (interactive resolution selection)
95111
# Check if already configured (unless FORCE_RECONFIGURE=1 to allow changing size)
96112
if [[ "${FORCE_RECONFIGURE:-0}" != "1" ]] && [[ -f /etc/modprobe.d/kvmfr.conf ]]; then
97113
IVSHMEM_SIZE=$(grep -oP 'static_size_mb=\K\d+' /etc/modprobe.d/kvmfr.conf 2>/dev/null || echo "")
98114
if [[ -n "$IVSHMEM_SIZE" ]]; then
99-
echo "Kernel module already configured (${IVSHMEM_SIZE}MB)"
115+
msg_success "Kernel module already configured (${IVSHMEM_SIZE}MB)"
100116
else
101117
# Config file exists but malformed - remove and reconfigure
102118
sudo rm -f /etc/modprobe.d/kvmfr.conf
@@ -141,41 +157,41 @@ if [[ -z "$IVSHMEM_SIZE" ]] || [[ "${FORCE_RECONFIGURE:-0}" == "1" ]]; then
141157

142158
# Validate IVSHMEM_SIZE before use (security check)
143159
if ! [[ "$IVSHMEM_SIZE" =~ ^[0-9]+$ ]] || [[ "$IVSHMEM_SIZE" -lt 32 ]] || [[ "$IVSHMEM_SIZE" -gt 512 ]]; then
144-
echo "Invalid IVSHMEM_SIZE: $IVSHMEM_SIZE (must be 32-512)"
160+
msg_error "Invalid IVSHMEM_SIZE: $IVSHMEM_SIZE (must be 32-512)"
145161
exit 1
146162
fi
147163

148-
echo "Configuring kernel module size..."
164+
msg_info "Configuring kernel module size..."
149165
sudo tee /etc/modprobe.d/kvmfr.conf >/dev/null <<EOF
150166
options kvmfr static_size_mb=$IVSHMEM_SIZE
151167
EOF
152-
echo "Kernel module size configured (${IVSHMEM_SIZE}MB)"
168+
msg_success "Kernel module size configured (${IVSHMEM_SIZE}MB)"
153169
fi
154170

155171
# Configure kernel module auto-load (after modprobe.d to ensure consistency)
156172
if [[ ! -f /etc/modules-load.d/kvmfr.conf ]]; then
157-
echo "Configuring kernel module auto-load..."
173+
msg_info "Configuring kernel module auto-load..."
158174
echo "kvmfr" | sudo tee /etc/modules-load.d/kvmfr.conf >/dev/null
159-
echo "Kernel module auto-load configured"
175+
msg_success "Kernel module auto-load configured"
160176
fi
161177

162178
# Add user to kvm group
163-
echo "Checking kvm group..."
179+
msg_info "Checking kvm group..."
164180
ADDED_TO_KVM=false
165181
if ! groups "$USER" | grep -q kvm; then
166182
sudo usermod -aG kvm "$USER"
167-
echo "Added to kvm group"
183+
msg_success "Added to kvm group"
168184
ADDED_TO_KVM=true
169185

170186
# Auto-refresh group membership using sg to avoid logout/login
171187
echo " Refreshing group membership for current session..."
172188
exec sg kvm "$0" "${ORIGINAL_SCRIPT_ARGS[@]}"
173189
else
174-
echo "Already in kvm group"
190+
msg_success "Already in kvm group"
175191
fi
176192

177193
# Create client configuration
178-
echo "Creating client configuration..."
194+
msg_info "Creating client configuration..."
179195
mkdir -p ~/.config/looking-glass
180196
cat >~/.config/looking-glass/client.ini <<EOF
181197
[app]
@@ -209,10 +225,10 @@ bufferLatency=5
209225
micDefault=allow
210226
micShowIndicator=no
211227
EOF
212-
echo "Configuration created with SPICE support (~/.config/looking-glass/client.ini)"
228+
msg_success "Configuration created with SPICE support (~/.config/looking-glass/client.ini)"
213229

214230
# Install desktop file for Walker launcher
215-
echo "Installing desktop launcher..."
231+
msg_info "Installing desktop launcher..."
216232
mkdir -p "$HOME/.local/share/applications"
217233

218234
# Try to find OMARCHY_PATH if not set
@@ -226,9 +242,9 @@ fi
226242

227243
if [[ -n "$OMARCHY_PATH" ]] && [[ -f "$OMARCHY_PATH/applications/windows-looking-glass.desktop" ]]; then
228244
cp "$OMARCHY_PATH/applications/windows-looking-glass.desktop" "$HOME/.local/share/applications/"
229-
echo "Desktop launcher installed (Windows [Looking Glass])"
245+
msg_success "Desktop launcher installed (Windows [Looking Glass])"
230246
else
231-
echo "⚠️ Desktop file not found - creating basic launcher"
247+
msg_warning "Desktop file not found - creating basic launcher"
232248
cat >"$HOME/.local/share/applications/windows-looking-glass.desktop" <<'DESKEOF'
233249
[Desktop Entry]
234250
Name=Windows [Looking Glass]
@@ -238,20 +254,20 @@ Terminal=false
238254
Type=Application
239255
Categories=System;Virtualization;
240256
DESKEOF
241-
echo "Basic desktop launcher created"
257+
msg_success "Basic desktop launcher created"
242258
fi
243259

244260
# Load kernel module (reload if already loaded to apply new configuration)
245-
echo "Loading kvmfr module..."
261+
msg_info "Loading kvmfr module..."
246262
if lsmod | grep -q kvmfr; then
247263
# Module already loaded - check if device exists with correct size
248264
if [[ ! -e /dev/kvmfr0 ]]; then
249265
echo "Module loaded but /dev/kvmfr0 missing - reloading with new config..."
250266
sudo rmmod kvmfr 2>/dev/null || true
251267
if sudo modprobe kvmfr; then
252-
echo "Module reloaded"
268+
msg_success "Module reloaded"
253269
else
254-
echo "⚠️ Module reload failed (reboot required)"
270+
msg_warning "Module reload failed (reboot required)"
255271
fi
256272
else
257273
# Device exists - verify via modinfo instead of unreliable dmesg parsing
@@ -261,20 +277,20 @@ if lsmod | grep -q kvmfr; then
261277
echo "Module loaded with wrong size (${module_size}MB, expected ${IVSHMEM_SIZE}MB) - reloading..."
262278
sudo rmmod kvmfr 2>/dev/null || true
263279
if sudo modprobe kvmfr; then
264-
echo "Module reloaded with ${IVSHMEM_SIZE}MB"
280+
msg_success "Module reloaded with ${IVSHMEM_SIZE}MB"
265281
else
266-
echo "⚠️ Module reload failed (reboot required)"
282+
msg_warning "Module reload failed (reboot required)"
267283
fi
268284
else
269-
echo "Module already loaded (${IVSHMEM_SIZE}MB)"
285+
msg_success "Module already loaded (${IVSHMEM_SIZE}MB)"
270286
fi
271287
fi
272288
else
273289
# Module not loaded - load it
274290
if sudo modprobe kvmfr; then
275-
echo "Module loaded"
291+
msg_success "Module loaded"
276292
else
277-
echo "⚠️ Module load failed (reboot required)"
293+
msg_warning "Module load failed (reboot required)"
278294
fi
279295
fi
280296

@@ -295,14 +311,14 @@ fi
295311
# Note: No need to check kvm group here - we already refreshed it with sg if needed
296312

297313
if [[ "$NEEDS_REBOOT" == true ]]; then
298-
echo "⚠️ Reboot required for:"
314+
msg_warning "Reboot required for:"
299315
echo "$REBOOT_REASONS"
300316
echo ""
301317
echo "After reboot, enable Looking Glass during Windows VM installation:"
302318
echo " omarchy-windows-vm install"
303319
echo ""
304320
else
305-
echo "Looking Glass client ready!"
321+
msg_success "Looking Glass client ready!"
306322
echo ""
307323
echo "Next step: Install Windows VM with Looking Glass support"
308324
echo " omarchy-windows-vm install"

bin/omarchy-looking-glass-launch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ SPICE_DIR="/var/run/omarchy-windows" # SPICE socket directory (tmpfs, auto-
88
SPICE_SOCKET_PATH="$SPICE_DIR/spice.sock" # SPICE Unix socket
99

1010
msg_error() {
11-
echo "❌ Error: $*"
11+
echo " Error: $*"
1212
}
1313

1414
msg_warning() {
1515
echo "⚠️ Warning: $*"
1616
}
1717

1818
msg_success() {
19-
echo "$*"
19+
echo " $*"
2020
}
2121

2222
msg_info() {

0 commit comments

Comments
 (0)