Compare commits

...

8 Commits
0.1 ... master

Author SHA1 Message Date
Bret ebe3c5313b Update 'bn3t.sh' 2020-11-15 04:19:56 -05:00
Bret 49d1955e1b Update 'bn3t-run.sh' 2020-11-15 04:19:29 -05:00
Bret dc078b32e1 Update 'LICENSE' 2020-11-15 04:18:22 -05:00
Bret 8d98561bb4 Update 'bn3t.sh' 2020-11-15 04:15:30 -05:00
Bret 7e664b699b Update 'bn3t-run.sh' 2020-11-15 04:14:26 -05:00
Bret b67f4f5431 Update 'README.md' 2020-11-15 04:13:23 -05:00
Bret Human 063e205f6c Holiday chroot edition 2019-12-07 05:11:24 -05:00
Bret R. Human 5b28f61aee Added Twitch client support 2019-05-21 08:52:53 -04:00
4 changed files with 375 additions and 172 deletions

23
LICENSE
View File

@ -1,11 +1,11 @@
bn3t
===
Copyright (c) 2018, Bret R. Human
Copyright (c) 2018-2021, Bret R. Human
All rights reserved.
Further documentation can be found at
https://mage.cynicaloptimist.me/en/bn3t
https://psi.cynicaloptimist.me/Caffarius/bn3t/
https://mage.cynop.me/en/bn3t
https://psi.cynop.me/Caffarius/bn3t/
Happy modding! -Bret
Redistribution and use in source and binary forms, with or without
@ -19,26 +19,19 @@ modification, are permitted provided that the following conditions are met:
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
"Built using software developed by Cynical Optimist - https://cynicaloptimist.me
Ask what we can build for you at info@cynicaloptimist.me"
4. The names "Cynical Optimist" and "Bret R. Human" and the software name listed
at the top of this document, or the domain "cynicaloptimist.me" or any
3. The names "Cynical Optimist" and "Bret R. Human" and the software name listed
at the top of this document, or the domain "cynop.me" or any
affiliated service must not be used to endorse or promote products derived
from this software without prior written permission. For written permission,
contact info@cynicaloptimist.me.
contact info@cynop.me.
5. Products derived from this software may not be called the software name
4. Products derived from this software may not be called the software name
listed at the top of this document nor may "Cynical Optimist" or the software
name listed at the top of this document appear in their names without prior
written permission of Bret R. Human.
6. Redistributions of any form whatsoever must retain the following
5. Redistributions of any form whatsoever must retain the following
acknowledgment:
"Built using software developed by Cynical Optimist - https://cynicaloptimist.me
Ask what we can build for you at info@cynicaloptimist.me"
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

View File

@ -4,4 +4,4 @@ Wrapper for setting up/maintaining a Battle.net install, handy for running it as
## Usage
See the wiki article at https://mage.cynicaloptimist.me/en/Bn3t
See the wiki article at https://mage.cynop.me/en/Bn3t

View File

@ -1,17 +1,17 @@
#!/bin/bash
## Copyright © 2018 Bret Human
## https://cynicaloptimist.me/
## Copyright © 2018-2021 Bret Human
## https://cynop.me/
##
## Documentation at:
## https://mage.cynicaloptimist.me/en/bn3t
## https://psi.cynicaloptimist.me/Caffarius/bn3t/
## https://mage.cynop.me/en/bn3t
## https://psi.cynop.me/Caffarius/bn3t/
##
## For questions or comments write:
## info@cynicaloptimist.me
## info@cynop.me
#####################################################################
# bn3t-run
script_ver="0.1"
page="https://mage.cynicaloptimist.me/en/bn3t"
script_ver="0.3.1"
page="https://mage.cynop.me/en/bn3t"
# author: Bret Human
# date: Dec 6, 2018
#
@ -38,24 +38,27 @@ page="https://mage.cynicaloptimist.me/en/bn3t"
runas_user="`whoami`"
app_name="Battle.net"
dl_addr="https://www.battle.net/download/getInstallerForGame?os=win&locale=enUS&version=LIVE&gameProgram=BATTLENET_APP"
tc_addr="https://desktop.twitchsvc.net/installer/windows/TwitchSetup.exe"
install_dir="/drive_c/Program Files (x86)"
app_loc="/Battle.net/Battle.net.exe"
console="bash"
usage="bn3t-run, version ${script_ver}
Usage: ./`basename ${0}` -g (game) -p (prefix) -a (arch) -dvsbwtnchx
-g | Launches the game of your choice
-p | Selects the location of the Wine prefix
-a | Selects the architecture to run as (32 | 64)
-d | Debug messages on (turns verbose on)
-v | Verbose messages on
-s | Runs ${app_name} setup
-b | Runs wineboot
-w | Runs winetricks
-t | Attempts to launch to the system tray
-n | No BS mode - doesn't launch an app (for boot/tricks/console safety)
-c | Launch a console session as specified user (can launch Xapps)
-d | Debug messages on (turns verbose on)
-g | Launches the game of your choice
-h | Help (this message)
-m | Runs Twitch client
-n | No BS mode - doesn't launch an app (for boot/tricks/console safety)
-p | Selects the location of the Wine prefix
-s | Runs ${app_name} setup
-t | Attempts to launch to the system tray
-v | Verbose messages on
-w | Runs winetricks
-x | Force upgrade DXVK
-z | Set the DISPLAY variable
See more documentation at: ${page}"
# Catch CTRL+C and cleanup
@ -63,12 +66,14 @@ trap "echo '' && inform '---------------------------------' && inform 'Caught CT
## Set default environment
cd /home/"${runas_user}"
export RADV_PERFTEST=aco
export WINEPREFIX="/home/${runas_user}/.bnet"
export HOME="/home/${runas_user}"
export USER="${runas_user}"
export USERNAME="${runas_user}"
export LOGNAME="${runas_user}"
export WINEDEBUG=-all
#export WINEDLLOVERRIDES="winemenubuilder.exe=d"
export XAUTHORITY="/home/${runas_user}/.Xauthority"
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin"
unset OLDPWD
@ -77,6 +82,8 @@ unset SUDO_COMMAND
unset SUDO_USER
unset SUDO_UID
## Define our functions
function debug () {
if [ ! "${WINEDEBUG}" ]; then
@ -90,6 +97,13 @@ function inform () {
fi
}
if [ -z "${DISPLAY}" ]; then
inform "DISPLAY not set - using default (0.0)";
export DISPLAY=:0.0
else
debug "Using DISPLAY variable: ${DISPLAY}";
fi
function clean {
debug "clean"
@ -109,6 +123,7 @@ function clean {
unset game_name
unset game_start
unset to_tray
unset DISPLAY
# Func
unset debug
@ -223,9 +238,29 @@ function run_wine () {
## Pick up any arguments provided
while getopts ":g:G:p:P:a:A:dDvVsSbBwWtTnNcChHxX" option; do
while getopts ":a:A:g:G:p:P:bBcCdDhHmMnNsStTvVwWxXzZ" option; do
case "${option}" in
"g"|"G") game_launch="${OPTARG}";;
"a"|"A")
case "${OPTARG}" in
32) export WINEARCH=win32;;
64) export WINEARCH=win64;;
*) inform "Weird architecture: ${OPTARG}, ignoring";;
esac
;;
"b"|"B")
echo "Running wineboot..."
nobs_mode="y"
if [ "${WINEDEBUG}" ]; then
wineboot > /dev/null 2>&1
else
wineboot
fi
;;
"c"|"C")
echo "Running console..."
nobs_mode="y"
${console}
;;
"d"|"D")
if [ "${WINEDEBUG}" ]; then
unset WINEDEBUG
@ -234,13 +269,61 @@ while getopts ":g:G:p:P:a:A:dDvVsSbBwWtTnNcChHxX" option; do
app_verbose="y"
fi
;;
"g"|"G") game_launch="${OPTARG}";;
"h"|"H")
echo "${usage}"
warp 0
;;
"m"|"M")
echo "Running Twitch Client..."
nobs_mode="y"
if [ -d ${WINEPREFIX}/drive_c/users/${runas_user}/Application\ Data/Twitch ]; then
wine C:\\users\\${runas_user}\\Application\ Data\\Twitch\\Bin\\Twitch.exe
else
inform "...but it helps to install it first..."
if [ ! -f "${WINEPREFIX}/drive_c/TwitchSetup.exe" ]; then
inform "${WINEPREFIX}/drive_c/TwitchSetup.exe was not found. Retreiving."
wget -O "${WINEPREFIX}/drive_c/TwitchSetup.exe" "${tc_addr}" ||
(echo "Failed to download installer from ${tc_addr}"; warp 1)
fi
wine "${WINEPREFIX}/drive_c/TwitchSetup.exe"
fi
;;
"n"|"N")
inform "...with No BS..."
nobs_mode="y"
;;
"p"|"P") export WINEPREFIX="${OPTARG}";;
"a"|"A")
case "${OPTARG}" in
32) export WINEARCH=win32;;
64) export WINEARCH=win64;;
*) inform "Weird architecture: ${OPTARG}, ignoring";;
esac
"s"|"S")
nobs_mode="y"
if [ -f "${WINEPREFIX}${install_dir}${app_loc}" ]; then
echo "${app_name} looks like it's already installed. Aborting setup."
warp 1
else
echo "Running setup..."
if [ ! -f "${WINEPREFIX}/drive_c/${app_name}-Setup.exe" ]; then
inform "${WINEPREFIX}/drive_c/${app_name}-Setup.exe was not found. Retreiving."
wget -O "${WINEPREFIX}/drive_c/${app_name}-Setup.exe" "${dl_addr}" ||
(echo "Failed to download installer from ${dl_addr}" && warp 1)
else
inform "Looks like the installer is in place. Executing."
fi
run_wine "${WINEPREFIX}/drive_c/${app_name}-Setup.exe"
fi
;;
"t"|"T")
to_tray="--autostarted"
inform "Attempting hide to system tray"
;;
"v"|"V")
if [ "${WINEDEBUG}" ]; then
if [ ! "${app_verbose}" ]; then
app_verbose="y"
#inform "Run verbose enabled"
inform "`realpath "${0}"` version ${script_ver} running as ${runas_user}"
fi
fi
;;
"w"|"W")
echo "Running winetricks..."
@ -251,23 +334,6 @@ while getopts ":g:G:p:P:a:A:dDvVsSbBwWtTnNcChHxX" option; do
winetricks
fi
;;
"s"|"S")
nobs_mode="y"
if [ -f "${WINEPREFIX}${install_dir}${app_loc}" ]; then
echo "${app_name} looks like it's already installed. Aborting setup."
warp 1
else
echo "Running setup..."
if [ ! -f "/tmp/${app_name}-Setup.exe" ]; then
inform "/tmp/${app_name}-Setup.exe was not found. Retreiving."
wget -O "/tmp/${app_name}-Setup.exe" "${dl_addr}" ||
(echo "Failed to download installer from ${dl_addr}" && warp 1)
else
inform "Looks like the installer is in place. Executing."
fi
run_wine "/tmp/${app_name}-Setup.exe"
fi
;;
"x"|"X")
echo "Upgrading dxvk..."
nobs_mode="y"
@ -277,44 +343,9 @@ while getopts ":g:G:p:P:a:A:dDvVsSbBwWtTnNcChHxX" option; do
winetricks --force dxvk
fi
;;
"b"|"B")
echo "Running wineboot..."
nobs_mode="y"
if [ -d "${WINEPREFIX}" ]; then
echo "${WINEPREFIX} already exists! Refusing to wineboot."
else
if [ "${WINEDEBUG}" ]; then
wineboot > /dev/null 2>&1
else
wineboot
fi
fi
;;
"n"|"N")
inform "...with No BS..."
nobs_mode="y"
;;
"c"|"C")
echo "Running console..."
nobs_mode="y"
${console}
;;
"v"|"V")
if [ "${WINEDEBUG}" ]; then
if [ ! "${app_verbose}" ]; then
app_verbose="y"
#inform "Run verbose enabled"
inform "`realpath "${0}"` version ${script_ver} running as ${runas_user}"
fi
fi
;;
"t"|"T")
to_tray="--autostarted"
inform "Attempting hide to system tray"
;;
"h"|"H")
echo "${usage}"
warp 0
"z"|"Z")
inform "DISPLAY set to ${OPTARG}"
DISPLAY=${OPTARG}
;;
*) echo "Unknown option: -${OPTARG}"
echo "${usage}"

335
bn3t.sh
View File

@ -1,17 +1,17 @@
#!/bin/bash
## Copyright © 2018 Bret Human
## https://cynicaloptimist.me/
## Copyright © 2018-2021 Bret Human
## https://cynop.me/
##
## Documentation at:
## https://mage.cynicaloptimist.me/en/bn3t
## https://psi.cynicaloptimist.me/Caffarius/bn3t/
## https://mage.cynop.me/en/bn3t
## https://psi.cynop.me/Caffarius/bn3t/
##
## For questions or comments write:
## info@cynicaloptimist.me
## info@cynop.me
#####################################################################
# bn3t
script_ver="0.1"
page="https://mage.cynicaloptimist.me/en/bn3t"
script_ver="0.3.1"
page="https://mage.cynop.me/en/bn3t"
# author: Bret Human
# date: Dec 6, 2018
#
@ -35,7 +35,7 @@ page="https://mage.cynicaloptimist.me/en/bn3t"
# ./bn3t.sh -u username -bxs
#
# Or I guess you could manually download the script from:
dl_addr="https://psi.cynicaloptimist.me/Caffarius/bn3t/raw/branch/master/bn3t-run.sh"
dl_addr="https://psi.cynop.me/Caffarius/bn3t/raw/branch/master/bn3t-run.sh"
#####################################################################
#
# This is free software; you are free to change and redistribute it.
@ -46,25 +46,29 @@ dl_addr="https://psi.cynicaloptimist.me/Caffarius/bn3t/raw/branch/master/bn3t-ru
runas_user="`whoami`"
app_name="Battle.net"
run_cmd="bn3t-run.sh"
jail_dir="/var/jail"
check_wait="3"
usage="bn3t, version ${script_ver}
Usage: ./`basename ${0}` -g (game) -u (user) -p (prefix) -a (arch) -dvksbwtnchxi
-g | Launches the game of your choice
-u | Runs ${app_name} as the user specified
-p | Selects the location of the Wine prefix
-a | Selects the architecture to run as (32 | 64)
-d | Debug messages on (turns verbose on)
-v | Verbose messages on
-k | Kill all processes for a user (not current user or root)
-s | Runs ${app_name} setup
-b | Runs wineboot
-w | Runs winetricks
-t | Attempts to launch to the system tray
-n | No BS mode - doesn't launch an app (for boot/tricks/console safety)
-c | Launch a console session as specified user (can launch Xapps)
-d | Debug messages on (turns verbose on)
-g | Launches the game of your choice
-h | Help (this message)
-x | Force upgrade DXVK
-i | Install the bn3t-run script for the specified user - mandantory
-j | Run ${run_cmd} inside a chroot jail at ${jail_dir}
-k | Kill all processes for a user (not current user or root)
-m | Runs Twitch Client (for /M/ods - I'm running out of letters)
-n | No BS mode - doesn't launch an app (for boot/tricks/console safety)
-p | Selects the location of the Wine prefix
-s | Runs ${app_name} setup
-t | Attempts to launch to the system tray
-u | Runs ${app_name} as the user specified
-v | Verbose messages on
-w | Runs winetricks
-x | Force upgrade DXVK
-z | Set the DISPLAY variable used in ${run_cmd}
See more documentation at: ${page}"
# Catch CTRL+C and cleanup
@ -78,13 +82,22 @@ function refresh {
function debug () {
if [ "${app_debug}" ]; then
echo "-D- ${1}"
echo -e "-D- ${1}"
fi
}
function inform () {
if [ "${app_verbose}" ]; then
echo "--- ${1}"
echo -e "--- ${1}"
fi
}
function buff_cmd_output () {
read cmd_input
cmd_output=$(eval "${cmd_input}")
if [ ! -z "${cmd_output}" ]; then
debug "${cmd_output}"
fi
}
@ -123,14 +136,40 @@ function die () {
else
if [ "${runas_user}" == "root" ]; then
debug "Root? Madness. Just removing xhost then..."
inform "`xhost -SI:localuser:"${runas_user}"`"
inform "`xhost -SI:localuser:root`"
else
debug "Launched as ${runas_user}, killing processes"
debug "Launched as ${runas_user}, killing processes and removing xhost..."
sudo -u "${runas_user}" -- bash -c "kill -9 -1"
inform "`xhost -SI:localuser:"${runas_user}"`"
fi
fi
if [ "${jailbird}" == "1" ]; then
debug "Removing root from xhost..."
inform "`xhost -SI:localuser:root`"
debug "Delaying jail demolition..."
sleep 1
debug "Demolishing jail..."
echo "sudo rm ${jail_dir}/${runas_user}/bin 2>&1" | buff_cmd_output
echo "sudo rm ${jail_dir}/${runas_user}/sbin 2>&1" | buff_cmd_output
echo "sudo rm ${jail_dir}/${runas_user}/lib 2>&1" | buff_cmd_output
echo "sudo rm ${jail_dir}/${runas_user}/lib64 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/usr 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/etc 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/tmp/pulse-socket 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/dev 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/proc 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/sys 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/run 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/tmp 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/var 2>&1" | buff_cmd_output
echo "sudo umount -l ${jail_dir}/${runas_user}/home/${runas_user} 2>&1" | buff_cmd_output
debug "Jail demolished."
fi
clean
unset clean
unset fizzle
@ -182,12 +221,18 @@ function check {
## Pick up any arguments provided
# None are required, we'll use default values.
launch_opt=""
while getopts ":g:G:u:U:p:P:a:A:dDvVkKsSbBwWtTnNcChHxXiI" option; do
while getopts ":a:A:g:G:p:P:u:U:z:Z:bBcCdDhHiIjJkKmMnNsStTvVwWxX" option; do
case "${option}" in
"k"|"K") die 0;;
"g"|"G") launch_opt="${launch_opt} -g ${OPTARG}";;
"p"|"P") launch_opt="${launch_opt} -p ${OPTARG}";;
"a"|"A") launch_opt="${launch_opt} -a ${OPTARG}";;
"b"|"B")
inform "Wineboot mode"
launch_opt="${launch_opt} -b"
;;
"c"|"C")
inform "Console requested"
nobs_mode="y"
launch_opt="${launch_opt} -c"
;;
"d"|"D")
if [ ! "${app_debug}" ]; then # Let's not do this too much...
app_debug="y"
@ -205,50 +250,10 @@ while getopts ":g:G:u:U:p:P:a:A:dDvVkKsSbBwWtTnNcChHxXiI" option; do
debug ""
fi
;;
"w"|"W")
inform "Winetricks mode"
launch_opt="${launch_opt} -w"
;;
"s"|"S")
inform "Setup mode"
nobs_mode="y"
launch_opt="${launch_opt} -s"
;;
"x"|"X")
inform "Force upgrading dxvk"
launch_opt="${launch_opt} -x"
;;
"b"|"B")
inform "Wineboot mode"
launch_opt="${launch_opt} -b"
;;
"n"|"N")
inform "No BS mode"
nobs_mode="y"
launch_opt="${launch_opt} -n"
;;
"c"|"C")
inform "Console requested"
nobs_mode="y"
launch_opt="${launch_opt} -c"
;;
"v"|"V")
if [ ! "${app_debug}" ]; then
if [ ! "${app_verbose}" ]; then
app_verbose="y"
inform "Verbose enabled"
inform "`realpath "${0}"` version ${script_ver} running as `whoami`"
launch_opt=" -v${launch_opt}"
fi
fi
;;
"t"|"T")
debug "Hiding to system tray"
launch_opt="${launch_opt} -t"
;;
"u"|"U")
debug "Setting user to ${OPTARG}"
runas_user="${OPTARG}"
"g"|"G") launch_opt="${launch_opt} -g ${OPTARG}";;
"h"|"H")
echo "${usage}"
fizzle 0
;;
"i"|"I")
debug "User-side install requested"
@ -276,12 +281,58 @@ while getopts ":g:G:u:U:p:P:a:A:dDvVkKsSbBwWtTnNcChHxXiI" option; do
(echo "Failed to change permissions on ${app_dir}${run_cmd}" && fizzle 1)
fi
echo "Installed successfully."
echo "Install process completed."
fizzle 0
;;
"h"|"H")
echo "${usage}"
fizzle 0
"j"|"J")
debug "Running ${appname} in a chroot jail under ${jail_dir}/${runas_user}/"
jailbird=1
;;
"k"|"K") die 0;;
"m"|"M")
inform "Twitch mode"
launch_opt="${launch_opt} -m"
;;
"n"|"N")
inform "No BS mode"
nobs_mode="y"
launch_opt="${launch_opt} -n"
;;
"p"|"P") launch_opt="${launch_opt} -p ${OPTARG}";;
"s"|"S")
inform "Setup mode"
nobs_mode="y"
launch_opt="${launch_opt} -s"
;;
"t"|"T")
debug "Hiding to system tray"
launch_opt="${launch_opt} -t"
;;
"u"|"U")
debug "Setting user to ${OPTARG}"
runas_user="${OPTARG}"
;;
"v"|"V")
if [ ! "${app_debug}" ]; then
if [ ! "${app_verbose}" ]; then
app_verbose="y"
inform "Verbose enabled"
inform "`realpath "${0}"` version ${script_ver} running as `whoami`"
launch_opt=" -v${launch_opt}"
fi
fi
;;
"w"|"W")
inform "Winetricks mode"
launch_opt="${launch_opt} -w"
;;
"x"|"X")
inform "Force upgrading dxvk"
launch_opt="${launch_opt} -x"
;;
"z"|"Z")
inform "Setting DISPLAY to ${OPTARG}"
launch_opt="${launch_opt} -z ${OPTARG}"
;;
* ) echo "Unknown option: -${OPTARG}"
echo "${usage}"
@ -300,11 +351,139 @@ if [ "`whoami`" == "${runas_user}" ]; then
debug "Launching as original user, going native"
${app_dir}${run_cmd}${launch_opt}
else
debug "Launching as ${runas_user}, checking xhost"
debug "Checking xhost"
if [ ! "`xhost | grep ${runas_user}`" ]; then
inform "`xhost +SI:localuser:"${runas_user}"`"
fi
sudo -u "${runas_user}" -- dbus-launch ${app_dir}${run_cmd}${launch_opt}
if [ ! "${jailbird}" == "1" ]; then
# Just launch it as a regular secondary user app
debug "Launching as ${runas_user}..."
sudo -u "${runas_user}" -- dbus-launch ${app_dir}${run_cmd}${launch_opt}
else
# Hooooooowiiiiiiee. We're gonna build a jail!
if [ ! "`xhost | grep root`" ]; then
inform "`xhost +SI:localuser:root`"
fi
debug "Preparing ${runas_user}'s chroot environment..."
sudo mkdir -p ${jail_dir}/${runas_user}/tmp
sudo mkdir -p ${jail_dir}/${runas_user}/usr
sudo mkdir -p ${jail_dir}/${runas_user}/var
sudo mkdir -p ${jail_dir}/${runas_user}/proc
sudo mkdir -p ${jail_dir}/${runas_user}/sys
sudo mkdir -p ${jail_dir}/${runas_user}/dev
sudo mkdir -p ${jail_dir}/${runas_user}/run
sudo mkdir -p ${jail_dir}/${runas_user}/etc
sudo mkdir -p ${jail_dir}/${runas_user}/home/${runas_user}
if mountpoint ${jail_dir}/${runas_user}/tmp > /dev/null; then
debug "/tmp is already mounted?"
else
debug "Mounting /tmp..."
sudo mount -t tmpfs -o size=2G tmpfs ${jail_dir}/${runas_user}/tmp
fi
if mountpoint ${jail_dir}/${runas_user}/proc > /dev/null; then
debug "/proc is already mounted?"
else
debug "Mounting /proc..."
sudo mount --bind /proc ${jail_dir}/${runas_user}/proc
fi
if mountpoint ${jail_dir}/${runas_user}/sys > /dev/null; then
debug "/sys is already mounted?"
else
debug "Mounting /sys..."
sudo mount --bind /sys ${jail_dir}/${runas_user}/sys
fi
if mountpoint ${jail_dir}/${runas_user}/dev > /dev/null; then
debug "/dev is already mounted?"
else
debug "Mounting /dev..."
sudo mount --bind /dev ${jail_dir}/${runas_user}/dev
fi
if mountpoint ${jail_dir}/${runas_user}/run > /dev/null; then
debug "/run is already mounted?"
else
debug "Mounting /run..."
sudo mount --bind /run ${jail_dir}/${runas_user}/run
fi
if mountpoint ${jail_dir}/${runas_user}/var > /dev/null; then
debug "/var is already mounted?"
else
debug "Mounting /var..."
sudo mount --bind /var ${jail_dir}/${runas_user}/var
fi
if mountpoint ${jail_dir}/${runas_user}/etc > /dev/null; then
debug "/etc is already mounted?"
else
debug "Mounting /etc..."
sudo mount --bind /etc ${jail_dir}/${runas_user}/etc
fi
if mountpoint ${jail_dir}/${runas_user}/usr > /dev/null; then
debug "/usr is already mounted?"
else
debug "Mounting /usr..."
sudo mount --bind /usr ${jail_dir}/${runas_user}/usr
fi
if mountpoint ${jail_dir}/${runas_user}/home/${runas_user} > /dev/null; then
debug "/home/${runas_user} is already mounted?"
else
debug "Mounting /home/${runas_user}..."
sudo mount --bind /mnt/ace/home/${runas_user} ${jail_dir}/${runas_user}/home/${runas_user}
fi
if [ ! -d ${jail_dir}/${runas_user}/bin ]; then
debug "Linking /bin to usr/bin..."
sudo bash -c "cd ${jail_dir}/${runas_user}; ln -s usr/bin bin"
fi
if [ ! -d ${jail_dir}/${runas_user}/sbin ]; then
debug "Linking /sbin to usr/bin (that's not a typo!)..."
sudo bash -c "cd ${jail_dir}/${runas_user}; ln -s usr/bin sbin"
fi
if [ ! -d ${jail_dir}/${runas_user}/lib ]; then
debug "Linking /lib to usr/lib..."
sudo bash -c "cd ${jail_dir}/${runas_user}; ln -s usr/lib lib"
fi
if [ ! -d ${jail_dir}/${runas_user}/lib64 ]; then
debug "Linking /lib64 to usr/lib (that's not a typo!)..."
sudo bash -c "cd ${jail_dir}/${runas_user}; ln -s usr/lib lib64"
fi
if [ ! -S ${jail_dir}/${runas_user}/tmp/pulse-socket ]; then
if [ ! -f ${jail_dir}/${runas_user}/tmp/pulse-socket ]; then
debug "Creating /tmp/pulse-socket to link sound..."
sudo -u ${runas_user} touch ${jail_dir}/${runas_user}/tmp/pulse-socket
fi
if mountpoint ${jail_dir}/${runas_user}/tmp/pulse-socket > /dev/null; then
debug "/tmp/pulse-socket is already mounted?"
else
debug "Mounting /tmp/pulse-socket..."
sudo mount --bind /tmp/pulse-socket ${jail_dir}/${runas_user}/tmp/pulse-socket
fi
else
debug "/tmp/pulse-socket is already a socket?"
fi
debug "...chroot prepared."
debug "Launching as ${runas_user} jailed inside ${jail_dir}/${runas_user}/..."
sudo -u root -- chroot ${jail_dir}/${runas_user}/ sudo -u ${runas_user} dbus-launch ${app_dir}${run_cmd}${launch_opt}
fi
debug "...returned to wrapper."
fi
@ -314,4 +493,4 @@ debug "Final Notice"
if [ "${app_check}" ]; then
check
fizzle 0
fi
fi