Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Depends: device-tree-compiler,
python3,
python3-yaml,
u-boot-menu,
xz-utils,
jq,
${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
189 changes: 189 additions & 0 deletions src/usr/lib/rsetup/cli/steam.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# shellcheck shell=bash

get_user_home() {
if [ -n "${PKEXEC_UID:-}" ]; then
getent passwd "${PKEXEC_UID}" | cut -d: -f6
elif [ -n "${SUDO_USER:-}" ]; then
getent passwd "${SUDO_USER}" | cut -d: -f6
else
echo "/home/$(whoami)"
fi
}

install_box64() {
wget https://ryanfortner.github.io/box64-debs/box64.list -O /etc/apt/sources.list.d/box64.list
wget -qO- https://ryanfortner.github.io/box64-debs/KEY.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
apt update -y && apt install -y box64-rk3588
}

install_box86() {
dpkg --add-architecture armhf
wget https://itai-nelken.github.io/weekly-box86-debs/debian/box86.list -O /etc/apt/sources.list.d/box86.list
wget -qO- https://itai-nelken.github.io/weekly-box86-debs/debian/KEY.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg
apt update -y && apt install -y box86
}

# 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
mkdir -p "${user_home}/.local/share/applications/"
cat <<EOF > "${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 > "${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

mkdir "${user_home}/wine/"
mkdir "${user_home}/wine/lib/"
# cp libwine.so ${user_home}/wine/lib/
# cp libwine.so.1 ${user_home}/wine/lib/
cd "${user_home}/wine/" || exit
latest_version=$(curl -s https://api.github.com/repos/Kron4ek/Wine-Builds/releases/latest | jq -r .tag_name)
curl -L -o "wine-latest-x86.tar.xz" "https://github.com/Kron4ek/Wine-Builds/releases/download/$latest_version/wine-$latest_version-x86.tar.xz"
xz -d wine-latest-x86.tar.xz
tar -xf wine-latest-x86.tar
cd "wine-$latest_version-x86/" || exit
cp -R ./* "${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
# #try to chown using either sudo_user or pkexec_uid
chown -R "${SUDO_USER:-${PKEXEC_UID}}" "${user_home}/wine"
echo "Run wine winecfg to let wine configure itself"
}

# 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)"
install_box86
install_box64
install_winex86
# install_wine64
# create necessary directories
mkdir -p "${user_home}/steam"
mkdir -p "${user_home}/steam/tmp"
cd "${user_home}/steam/tmp" || exit

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

# remove deb archives, not needed anymore
rm ./*.tar.xz ./steam.deb

# move deb contents to steam folder
mv ./usr/* ../
cd ../ && rm -rf ./tmp/

# create run script
echo '#!/bin/bash
export STEAMOS=1
export STEAM_RUNTIME=1
export DBUS_FATAL_WARNINGS=0
~/steam/bin/steam $@' > steam

# make script executable and move
chmod +x steam
mv steam /usr/local/bin/
apt 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 libibus-1.0-5 libdrm2:armhf libgbm1:armhf

}

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 purge -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 purge -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"

# 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 purge -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 libgbm1:armhf libdrm2:armhf


# Remove Box86 architecture
dpkg --remove-architecture armhf

# Update apt repositories and clean up
apt-get update -y
apt-get autoremove -y
}
32 changes: 32 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,32 @@
# 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 yesno "Are you sure you want to install Steam?"
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:"
}