Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Check Scripts
command: |
find . -type f -name '*.sh' | wc -l
find . -type f -name '*.sh' | xargs shellcheck --external-sources --severity=error --source-path="${PWD}/pengwin-setup.d:${PWD}/pengwin-setup.d/uninstall:tests"
find . -type f -name '*.sh' | xargs shellcheck -e SC2218 --external-sources --severity=error --source-path="${PWD}/pengwin-setup.d:${PWD}/pengwin-setup.d/uninstall:tests"
find . -type f -name '*.sh' | xargs shellcheck --external-sources --severity=style --source-path="${PWD}/pengwin-setup.d:${PWD}/pengwin-setup.d/uninstall:tests" || echo "Shellcheck has some warnings"
build:
docker:
Expand Down
47 changes: 44 additions & 3 deletions pengwin-setup.d/x410.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,55 @@ source "$(dirname "$0")/common.sh" "$@"
if [ -x "$(command -v x410.exe)" ]; then
if (confirm --title "X410" --yesno "It seems that X410 is already installed on your machine. Would you like to start it every time that Pengwin launches?" 10 80) then
echo "Configuring X410 to start on Pengwin launch"
sudo bash -c 'cat > /etc/profile.d/02-x410.sh' << EOF

connection=

for arg in "$@"; do
case "$arg" in
VSOCK)
connection=VSOCK
;;
TCP)
connection=TCP
;;
esac
done

if [[ -z ${connection} ]]; then
connection=$(menu --title "X410" --radiolist "Select how Pengwin connects to X410" 10 60 2 \
"TCP" "Use a TCP/IP connection" \
"VSOCK" "Use a VSOCK connection" 3>&1 1>&2 2>&3)

if [[ ${connection} == "${CANCELLED}" ]]; then
echo "Skipping X410"
exit 0
fi
fi

if [[ ${connection} == VSOCK ]]; then
sudo bash -c 'cat > /etc/profile.d/02-x410.sh' << EOP
#!/bin/sh
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent shebang usage. The VSOCK configuration uses #!/bin/sh while the TCP configuration uses #!/bin/sh as well, but the main script uses bash features. Consider using #!/bin/bash for consistency since the script uses bash-specific features like [[ ]].

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see the script is going into /etc/profile.d for maximum flexibility with zsh, those scripts must be tied to posix shell


(cmd-exe /c x410.exe /wm &> /dev/null &)
(cmd-exe /c x410.exe /wm /vsock &> /dev/null &)

export X410=yes

EOF
EOP
else
sudo bash -c 'cat > /etc/profile.d/02-x410.sh' << EOP
#!/bin/sh

if [ -n "\${WSL2}" ]; then
(cmd-exe /c x410.exe /wm /public &> /dev/null &)
else
(cmd-exe /c x410.exe /wm &> /dev/null &)
fi

export X410=yes

EOP
fi

#add_fish_support '02-x410'

#Make sure that DISPLAY points to the internal IP address
Expand Down
43 changes: 41 additions & 2 deletions rpm/pengwin-setup.d/x410.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,42 @@ source "$(dirname "$0")/common.sh" "$@"
if [ -x "$(command -v x410.exe)" ]; then
if (confirm --title "X410" --yesno "It seems that X410 is already installed on your machine. Would you like to start it every time that Pengwin launches?" 10 80) then
echo "Configuring X410 to start on Pengwin launch"
sudo bash -c 'cat > /etc/profile.d/02-x410.sh' << EOF

connection=

for arg in "$@"; do
case "$arg" in
VSOCK)
connection=VSOCK
;;
TCP)
connection=TCP
;;
esac
done

if [[ -z ${connection} ]]; then
connection=$(menu --title "X410" --radiolist "Select how Pengwin connects to X410" 10 60 2 \
"TCP" "Use a TCP/IP connection" \
"VSOCK" "Use a VSOCK connection" 3>&1 1>&2 2>&3)

if [[ ${connection} == "${CANCELLED}" ]]; then
echo "Skipping X410"
exit 0
fi
fi

if [[ ${connection} == VSOCK ]]; then
sudo bash -c 'cat > /etc/profile.d/02-x410.sh' << EOP
#!/bin/bash
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent shebang between pengwin-setup.d and rpm versions. The RPM version uses #!/bin/bash for VSOCK while pengwin-setup.d uses #!/bin/sh. These should be consistent across both implementations.

Copilot uses AI. Check for mistakes.

(cmd-exe /c x410.exe /wm /vsock &> /dev/null &)

export X410=yes

EOP
else
sudo bash -c 'cat > /etc/profile.d/02-x410.sh' << EOP
#!/bin/bash

if [ -n "\${WSL2}" ]; then
Expand All @@ -16,7 +51,11 @@ else
(cmd-exe /c x410.exe /wm &> /dev/null &)
fi

EOF
export X410=yes

EOP
fi

# Avoid collision with the other XServer
sudo rm -f /etc/profile.d/01-vcxsrv.sh
touch "${HOME}"/.should-restart
Expand Down
16 changes: 8 additions & 8 deletions tests/x410.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
source commons.sh
source mocks.sh

function testX410() {
run_pengwinsetup install GUI CONFIGURE X410
function testX410Tcp() {
run_pengwinsetup install GUI CONFIGURE X410 TCP

assertTrue "FILE PROFILE-X410" "[ -f /etc/profile.d/02-x410.sh ]"
assertFalse "VSOCK NOT PRESENT" "grep -q '/vsock' /etc/profile.d/02-x410.sh"
}

#WSL2= bash /etc/profile.d/02-x410.sh
#verify_call "cmd.exe /c x410.exe /wm"
#assertTrue "X410 WSL1" "$?"
function testX410Vsock() {
run_pengwinsetup install GUI CONFIGURE X410 VSOCK

#WSL2=1 bash /etc/profile.d/02-x410.sh
#verify_call "cmd.exe /c x410.exe /wm /public"
#assertTrue "X410 WSL2" "$?"
assertTrue "FILE PROFILE-X410" "[ -f /etc/profile.d/02-x410.sh ]"
assertTrue "VSOCK PRESENT" "grep -q '/vsock' /etc/profile.d/02-x410.sh"
}

function testUninstall() {
Expand Down