Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6774ce0
feat: add steam to rsetup
RadxaPanda Jun 21, 2024
f5dfb9e
fix: add requirested changes
RadxaPanda Jun 21, 2024
728f67f
fix: curl with -Ls to follow 302 redirection
RadxaYuntian Jul 10, 2024
828adcd
fix: overwrite existing keyring
RadxaYuntian Jul 10, 2024
521b7e0
fix: use redirection as -o won't overwrite existing file
RadxaYuntian Jul 10, 2024
ba18f2e
refactor: wrap package list
RadxaYuntian Jul 10, 2024
617307f
refactor: move foreign arch setup to parent function
RadxaYuntian Jul 10, 2024
70c0c5b
fix: avoid GitHub API due to quota limit
RadxaYuntian Jul 10, 2024
64fa98d
fix: use HEAD instead GET to avoid data download
RadxaYuntian Jul 10, 2024
861365d
refactor: create run script directly in the final destination
RadxaYuntian Jul 11, 2024
0836e12
refactor: unpack steam.deb in a temp dir
RadxaYuntian Jul 11, 2024
2377b9a
refactor: use logname to get real user
RadxaYuntian Jul 11, 2024
94d9721
fix: remove duplicated set -e
RadxaYuntian Jul 11, 2024
e754cf0
refactor: replace cd with pushd/popd
RadxaYuntian Jul 11, 2024
a264dfe
fix: ensure wine install with correct file owner
RadxaYuntian Jul 11, 2024
2fc4ce1
fix: wine and steam not being able to launch
RadxaPanda Jul 15, 2024
e9c9610
fix: escape $HOME and $@ when creating executables for wine and steam
RadxaPanda Jul 15, 2024
b95ed9a
fix: add an ignore shellcheck option
RadxaPanda Jul 15, 2024
46f30b5
chore: use cat instead of echo for the steam executable
RadxaPanda Jul 16, 2024
5a4a751
chore: fix typo in the steam executable
RadxaPanda Jul 17, 2024
c17f096
chore: fix binfmtd
RadxaPanda Jul 17, 2024
e9f9456
feat: improve Steam installation prompt for devices without panthor
RadxaPanda Jul 18, 2024
428b93a
chore: fix uninstall so it doesnt remove every single package it finds
RadxaPanda Jul 25, 2024
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
4 changes: 3 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ Architecture: all
Section: admin
Priority: standard
Essential: yes
Depends: device-tree-compiler,
Depends: curl,
device-tree-compiler,
gdisk,
librtui (>= 0.1.2),
parted,
pkexec | policykit-1 (<< 122-1),
python3,
python3-yaml,
u-boot-menu,
xz-utils,
${misc:Depends},
Suggests: aicrf-test,
gpiod,
Expand Down
1 change: 1 addition & 0 deletions src/usr/lib/rsetup/cli/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ source "/usr/lib/rsetup/cli/docker.sh"
source "/usr/lib/rsetup/cli/u-boot-menu.sh"
source "/usr/lib/rsetup/cli/wi-fi.sh"
source "/usr/lib/rsetup/cli/kernel.sh"
source "/usr/lib/rsetup/cli/steam.sh"

source "/usr/lib/rsetup/cli/test/main.sh"

Expand Down
202 changes: 202 additions & 0 deletions src/usr/lib/rsetup/cli/steam.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
# shellcheck shell=bash
get_user_home() {
getent passwd "$(logname)" | cut -d: -f6
}

install_box64() {
curl -Ls https://ryanfortner.github.io/box64-debs/box64.list > /etc/apt/sources.list.d/box64.list
curl -Ls https://ryanfortner.github.io/box64-debs/KEY.gpg | gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
apt-get update -y && apt-get install -y box64-rk3588
Copy link
Member

Choose a reason for hiding this comment

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

This can be listed in Depends of the repackaged steam.

}

install_box86() {
curl -Ls https://itai-nelken.github.io/weekly-box86-debs/debian/box86.list > /etc/apt/sources.list.d/box86.list
curl -Ls https://itai-nelken.github.io/weekly-box86-debs/debian/KEY.gpg | gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg
apt-get update -y && apt-get install -y box86
Copy link
Member

Choose a reason for hiding this comment

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

This can be listed in Depends of the repackaged steam.

}

# shellcheck disable=SC2120
# files are script files and reference arguments
install_winex86() {
local -r user_home="$(get_user_home)"
rm -rf "${user_home}/.wine/" "${user_home}/wine/"
# cp wine /usr/local/bin/
cat <<\EOF > /usr/local/bin/wine
#!/bin/bash
#export GALLIUM_HUD=simple,fps
setarch linux32 -L box86 $HOME/wine/bin/wine "$@"
EOF
cat <<\EOF > /usr/local/bin/wineserver
#!/bin/bash
box86 $HOME/wine/bin/wineserver "$@"
EOF
cat <<\EOF > /usr/local/bin/winetricks
#!/bin/bash
env BOX86_NOBANNER=1 box86 $HOME/wine/winetricks "$@"
EOF
chmod +x /usr/local/bin/winetricks
chmod +x /usr/local/bin/wineserver
chmod +x /usr/local/bin/wine
sudo -u "$(logname)" mkdir -p "${user_home}/.local/share/applications/"
cat <<EOF | sudo -u "$(logname)" tee "${user_home}/.local/share/applications/wine-config.desktop"
[Desktop Entry]
Version=1.0
Type=Application
Name=Wine Configuration
Comment=Configuration utility for Wine
Icon=wine
box86 Exec=/usr/local/bin/wine winecfg
Categories=Game;
Terminal=false
EOF
cat <<EOF | sudo -u "$(logname)" tee "${user_home}/.local/share/applications/wine-desktop.desktop"
[Desktop Entry]
Version=1.0
Type=Application
Name=Wine Desktop
Comment=Graphical desktop for Wine
Icon=wine
box86 Exec=/usr/local/bin/wine explorer /desktop=shell,1280x720 explorer.exe
Categories=Game;
Terminal=false
EOF

cat <<EOF > /etc/binfmt.d/wine.conf
:wine:M::MZ::/usr/local/bin/wine:
EOF

sudo -u "$(logname)" mkdir -p "${user_home}/wine/lib/"
# cp libwine.so ${user_home}/wine/lib/
# cp libwine.so.1 ${user_home}/wine/lib/
local wine_pkg
wine_pkg="$(sudo -u "$(logname)" mktemp -d)"
pushd "$wine_pkg" || return 1
latest_version="$(basename "$(curl -ILs -o /dev/null -w "%{url_effective}" https://github.com/Kron4ek/Wine-Builds/releases/latest)")"
curl -Lso "wine-$latest_version-x86.tar.xz" "https://github.com/Kron4ek/Wine-Builds/releases/download/$latest_version/wine-$latest_version-x86.tar.xz"
Copy link
Member

Choose a reason for hiding this comment

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

Make a wine package and install under /usr/lib/x86_64-linux-gnu as well

sudo -u "$(logname)" tar xf "wine-$latest_version-x86.tar.xz"
popd || return 1
sudo -u "$(logname)" cp -R "$wine_pkg/wine-$latest_version-x86"/* "${user_home}/wine"
# ln -s "${user_home}/wine/bin/wine" /usr/local/bin/wine
# ln -s "${user_home}/wine/bin/winecfg" /usr/local/bin/winecfg
# ln -s "${user_home}/wine/bin/wineserver" /usr/local/bin/wineserver
rm -rf "$wine_pkg"
}

# install_wine64() {
# __parameter_count_check 0 "$@"
# local -r user_home="$(get_user_home)"
# rm -r ~/.wine/
# rm -r ~/wine/
# cd ~
# wget https://github.com/Kron4ek/Wine-Builds/releases/download/8.16/wine-8.16-amd64.tar.xz
# mkdir ~/wine
# cd ~/wine
# xz -d ../wine-8.16-amd64.tar.xz
# tar -xvf ../wine-8.16-amd64.tar
# rm /usr/local/bin/wine /usr/local/bin/wineboot /usr/local/bin/winecfg /usr/local/bin/wineserver /usr/local/bin/wine64
# cd wine-8.16-amd64/
# ln -s ~/wine/wine-8.16-amd64/bin/wine /usr/local/bin/wine
# ln -s ~/wine/wine-8.16-amd64/bin/wine64 /usr/local/bin/wine64
# ln -s ~/wine/wine-8.16-amd64/bin/wineserver /usr/local/bin/wineserver
# ln -s ~/wine/wine-8.16-amd64/bin/winecfg /usr/local/bin/winecfg
# ln -s ~/wine/wine-8.16-amd64/bin/wineboot /usr/local/bin/wineboot
# cd ~
# rm wine-8.16-amd64.tar.xz
# }


install_steam() {
__parameter_count_check 0 "$@"
local -r user_home="$(get_user_home)"
dpkg --add-architecture armhf
install_box86
install_box64
install_winex86
# install_wine64
# create necessary directories
local steam_dir="${user_home}/steam" temp_dir
temp_dir="$(mktemp -d)"

rm -rf "$steam_dir"
mkdir -p "$steam_dir"
pushd "$temp_dir" || return 1

# download latest deb and unpack
wget https://cdn.cloudflare.steamstatic.com/client/installer/steam.deb
ar x steam.deb
tar xf data.tar.xz

# move deb contents to steam folder
mv ./usr/* "$steam_dir"
popd || return 1
rm -rf "$temp_dir"
Comment on lines +125 to +132
Copy link
Member

Choose a reason for hiding this comment

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

Those can be the content of the repackaged steam. Can we still install steam under say /usr/lib/x86_64-linux-gnu?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely can but then ull need to rebuild once in a while I think but it should be fine


# create run script
cat <<EOF >/usr/local/bin/steam
#!/bin/bash
export STEAMOS=1
export STEAM_RUNTIME=1
export DBUS_FATAL_WARNINGS=0
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
"\$HOME/steam/bin/steam" "$@"
EOF

# .desktop file
sudo -u "$(logname)" mkdir -p "${user_home}/.local/share/applications/"
sed -i 's|/usr/bin/steam|/usr/local/bin/steam|' "${steam_dir}/lib/steam/steam.desktop"
cp "${steam_dir}/lib/steam/steam.desktop" "${user_home}/.local/share/applications/"

# make script executable
chmod +x /usr/local/bin/steam
apt-get install -y libc6:armhf libsdl2-2.0-0:armhf libsdl2-image-2.0-0:armhf \
libsdl2-mixer-2.0-0:armhf libsdl2-ttf-2.0-0:armhf libopenal1:armhf \
libpng16-16:armhf libfontconfig1:armhf libxcomposite1:armhf \
libbz2-1.0:armhf libxtst6:armhf libsm6:armhf libice6:armhf \
libxinerama1:armhf libxdamage1:armhf libdrm2:armhf libgbm1:armhf libibus-1.0-5 \
zenity libgl1:armhf libgl1-mesa-dri:armhf binfmt-support

}

uninstall_steam() {
local -r user_home="$(get_user_home)"

# Remove Box64
rm /etc/apt/sources.list.d/box64.list
rm /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
apt-get remove -y box64-rk3588

# Remove Box86
rm /etc/apt/sources.list.d/box86.list
rm /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg
apt-get remove -y box86

# Remove Wine related files and directories
rm -rf "${user_home}/.wine" "${user_home}/wine"
rm -f /usr/local/bin/wine /usr/local/bin/wineserver /usr/local/bin/winetricks
rm -f "${user_home}/.local/share/applications/wine-config.desktop"
rm -f "${user_home}/.local/share/applications/wine-desktop.desktop"
rm -f "${user_home}/.local/share/applications/steam.desktop"
rm -f /etc/binfmt.d/wine.conf

# Remove Steam related files and directories
rm -rf "${user_home}/steam"
rm -f /usr/local/bin/steam

# Remove additional packages installed for Steam
apt-get remove -y --allow-remove-essential libc6:armhf libgcc-s1:armhf libsdl2-2.0-0:armhf libsdl2-image-2.0-0:armhf \
libsdl2-mixer-2.0-0:armhf libsdl2-ttf-2.0-0:armhf libopenal1:armhf \
libpng16-16:armhf libfontconfig1:armhf libxcomposite1:armhf \
libbz2-1.0:armhf libxtst6:armhf libsm6:armhf libice6:armhf \
libxinerama1:armhf libxdamage1:armhf libdrm2:armhf libgbm1:armhf \
zenity libgl1:armhf libgl1-mesa-dri:armhf binfmt-support


# Remove armhf architecture
if ! dpkg --remove-architecture armhf; then
echo "Failed to remove the armhf architecture. There might be some packages that are still using it."
fi

# Update apt repositories and clean up
apt-get update -y
apt-get remove -y
}
37 changes: 37 additions & 0 deletions src/usr/lib/rsetup/tui/task/steam/steam.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# shellcheck shell=bash

__task_steam_uninstall() {
if yesno "Are you sure to uninstall Steam?"
then
if uninstall_steam
then
msgbox "Steam was successfully uninstalled."
else
msgbox "Failed to uninstall steam." "$RTUI_PALETTE_ERROR"
fi
fi
}

__task_steam_install() {
if lsmod | grep -q panthor; then
text="Are you sure you want to install Steam?"
else
text="You are using a device that has an incompatible gpu, you may experience stutters or crashes, do you still want to install Steam?"
fi
if yesno "$text"
then
install_steam
fi
}

__task_steam() {
menu_init
# "$(get_user_home)/steam" exists
if [[ -d "$(get_user_home)/steam" ]]
then
menu_add __task_steam_uninstall "Uninstall Steam"
else
menu_add __task_steam_install "Install Steam"
fi
menu_show "Please select an option below:"
}
2 changes: 2 additions & 0 deletions src/usr/lib/rsetup/tui/task/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
source "/usr/lib/rsetup/tui/task/docker/docker.sh"
source "/usr/lib/rsetup/tui/task/ssh/ssh.sh"
source "/usr/lib/rsetup/tui/task/baota/baota.sh"
source "/usr/lib/rsetup/tui/task/steam/steam.sh"

__task() {
menu_init
Expand All @@ -13,5 +14,6 @@ __task() {
menu_add __task_ssh "SSH"
fi
menu_add __task_baota "Baota"
menu_add __task_steam "Steam"
menu_show "Please select an option below:"
}