added option to install latest cemu: -l

This commit is contained in:
HengiFettlich 2019-04-26 08:17:31 +02:00
parent fef062931c
commit d7e47b6964

View File

@ -1,137 +1,153 @@
#!/bin/bash #!/bin/bash
if (( $EUID == 0 )); then if (( $EUID == 0 )); then
echo "Do not run as root." echo "Do not run as root."
exit 1 exit 1
fi fi
if [ -z "$DISPLAY" ]; then if [ -z "$DISPLAY" ]; then
export DISPLAY=:0.0 export DISPLAY=:0.0
fi fi
# help function: # help function:
function printhelp { function printhelp {
echo "usage examples:" echo "usage examples:"
echo "Download latest working cemu + cemuhook + graphic packs and install to ~/.cemu (default):" echo "Download latest working cemu + cemuhook + graphic packs and install to ~/.cemu (default):"
echo "./cemutil.sh -a" echo "./cemutil.sh -a"
echo "Use local zips and install to ~/Documents/cemu:" echo "Download latest cemu + cemuhook + graphic packs and install to ~/.cemu (default):"
echo "./cemutil.sh -c cemu.zip -h cemuhook.zip -g graphicpacks.zip -i ~/Documents/cemu" echo "./cemutil.sh -l"
exit 1 echo "Use local zips and install to ~/Documents/cemu:"
echo "./cemutil.sh -c cemu.zip -h cemuhook.zip -g graphicpacks.zip -i ~/Documents/cemu"
exit 1
} }
function downloadlatest { function downloadlatest {
echo "Downloading latest cemu" echo "Downloading latest cemu"
#wget -q --show-progress -O cemutemp.zip $(curl -s http://cemu.info |grep .zip |awk -F '"' {'print $2'}) wget -q --show-progress -O cemutemp.zip $(curl -s http://cemu.info |grep .zip |awk -F '"' {'print $2'})
wget -q --show-progress -O cemutemp.zip http://cemu.info/releases/cemu_1.15.4.zip downloadassets
echo "Downloading latest cemuhook" return
wget -q --show-progress -O cemuhooktemp.zip $(curl -s https://cemuhook.sshnuke.net |grep .zip |awk -F '"' NR==2{'print $2'}) }
echo "Downloading latest graphics packs"
wget -q --show-progress -O gfxpacktemp.zip https://github.com$(curl https://github.com/slashiee/cemu_graphic_packs/releases |grep graphicPacks |awk -F '"' NR==1{'print $2'}) function downloadlatest_working {
echo "Downloading cemuhook shared fonts" echo "Downloading latest working cemu"
wget -q --show-progress -O sharedFonts.zip https://github.com/HengiFettlich/cemutil/raw/master/sharedFonts.zip wget -q --show-progress -O cemutemp.zip http://cemu.info/releases/cemu_1.15.5.zip
return downloadassets
return
}
function downloadassets {
echo "Downloading latest cemuhook"
wget -q --show-progress -O cemuhooktemp.zip $(curl -s https://cemuhook.sshnuke.net |grep .zip |awk -F '"' NR==2{'print $2'})
echo "Downloading latest graphics packs"
wget -q --show-progress -O gfxpacktemp.zip https://github.com$(curl https://github.com/slashiee/cemu_graphic_packs/releases |grep graphicPacks |awk -F '"' NR==1{'print $2'})
echo "Downloading cemuhook shared fonts"
wget -q --show-progress -O sharedFonts.zip https://github.com/HengiFettlich/cemutil/raw/master/sharedFonts.zip
return
} }
#Check installed software #Check installed software
declare -a reqsw=("wine" "bsdtar" "unzip" "glxinfo" "curl" "wget" "winetricks") declare -a reqsw=("wine" "bsdtar" "unzip" "glxinfo" "curl" "wget" "winetricks")
for i in "${reqsw[@]}" for i in "${reqsw[@]}"
do do
if ! [ -x "$(command -v $i)" ]; then if ! [ -x "$(command -v $i)" ]; then
echo "You must install $i" echo "You must install $i"
exit 1 exit 1
fi fi
done done
function checkgfxver { function checkgfxver {
echo "Checking graphics packages are new enough. To skip this check (on Nvidia for instance), run with -f flag." echo "Checking graphics packages are new enough. To skip this check (on Nvidia for instance), run with -f flag."
if ! $(glxinfo | grep -q -e 'Mesa 18.2' -e 'Mesa 18.3' -e 'Mesa 18.4' -e 'Mesa 19'); then if ! $(glxinfo | grep -q -e 'Mesa 18.2' -e 'Mesa 18.3' -e 'Mesa 18.4' -e 'Mesa 19'); then
echo "You must install at least Mesa 18.2.0" echo "You must install at least Mesa 18.2.0"
exit 1 exit 1
fi fi
if ! $(glxinfo | grep -q -e "LLVM 9" -e "LLVM 8" -e "LLVM 7"); then if ! $(glxinfo | grep -q -e "LLVM 9" -e "LLVM 8" -e "LLVM 7"); then
echo "You must install Mesa built with at least LLVM 7" echo "You must install Mesa built with at least LLVM 7"
exit 1 exit 1
fi fi
if ! $(glxinfo | grep -q "4.5 (Compat"); then if ! $(glxinfo | grep -q "4.5 (Compat"); then
echo "Your hardware doesn't support the required OpenGL version." echo "Your hardware doesn't support the required OpenGL version."
echo "You may attempt using MESA_GL_VERSION_OVERRIDE=4.4COMPAT in the LaunchCEMU script." echo "You may attempt using MESA_GL_VERSION_OVERRIDE=4.4COMPAT in the LaunchCEMU script."
echo "This isn't officially supported, and may cause heavy glitches or not work. Proceeding as usual..." echo "This isn't officially supported, and may cause heavy glitches or not work. Proceeding as usual..."
fi fi
return return
} }
#Check for args #Check for args
if [[ ! $@ =~ ^\-.+ ]] if [[ ! $@ =~ ^\-.+ ]]
then then
printhelp; printhelp;
fi fi
#Handle args #Handle args
while getopts ":c:h:g:afi:" opt; do while getopts ":c:h:g:alfi:" opt; do
case ${opt} in case ${opt} in
c ) c )
cemuzip=$OPTARG cemuzip=$OPTARG
if [ ! -f "$cemuzip" ]; then if [ ! -f "$cemuzip" ]; then
echo "cemu zip doesn't exist" echo "cemu zip doesn't exist"
exit 1 exit 1
fi fi
;; ;;
h ) h )
cemuhookzip=$OPTARG cemuhookzip=$OPTARG
if [ ! -f "$cemuhookzip" ]; then if [ ! -f "$cemuhookzip" ]; then
echo "cemuhook zip doesn't exist" echo "cemuhook zip doesn't exist"
exit 1 exit 1
fi fi
;; ;;
g ) g )
gfxpackzip=$OPTARG gfxpackzip=$OPTARG
if [ ! -f "$gfxpackzip" ]; then if [ ! -f "$gfxpackzip" ]; then
echo "graphic packs zip doesn't exist" echo "graphic packs zip doesn't exist"
exit 1 exit 1
fi fi
;; ;;
a ) a )
downloadlatest downloadlatest_working
;; ;;
f ) l )
skipgfxcheck=1 downloadlatest
;; ;;
i ) f )
instdir=$OPTARG skipgfxcheck=1
;; ;;
\? ) i )
printhelp instdir=$OPTARG
;; ;;
: ) \? )
echo "Invalid option: $OPTARG requires an argument" 1>&2 printhelp
printhelp ;;
;; : )
esac echo "Invalid option: $OPTARG requires an argument" 1>&2
printhelp
;;
esac
done done
shift $((OPTIND -1)) shift $((OPTIND -1))
#check gfx package vers #check gfx package vers
if [[ "$skipgfxcheck" == "" ]]; then if [[ "$skipgfxcheck" == "" ]]; then
checkgfxver checkgfxver
fi fi
#Set opts if unset #Set opts if unset
if [[ "$instdir" == "" ]]; then if [[ "$instdir" == "" ]]; then
instdir=$HOME/.cemu instdir=$HOME/.cemu
fi fi
if [[ "$cemuzip" == "" ]]; then if [[ "$cemuzip" == "" ]]; then
cemuzip=cemutemp.zip cemuzip=cemutemp.zip
fi fi
if [[ "$cemuhookzip" == "" ]]; then if [[ "$cemuhookzip" == "" ]]; then
cemuhookzip=cemuhooktemp.zip cemuhookzip=cemuhooktemp.zip
fi fi
if [[ "$gfxpackzip" == "" ]]; then if [[ "$gfxpackzip" == "" ]]; then
gfxpackzip=gfxpacktemp.zip gfxpackzip=gfxpacktemp.zip
fi fi
if [[ "$sharedFonts" == "" ]]; then if [[ "$sharedFonts" == "" ]]; then
sharedFonts=sharedFonts.zip sharedFonts=sharedFonts.zip
fi fi
#Extract zips #Extract zips
@ -141,38 +157,38 @@ mkdir -p $instdir
#Unpack downloaded zips if applicable #Unpack downloaded zips if applicable
if [ -f "$cemuzip" ]; then if [ -f "$cemuzip" ]; then
bsdtar -xf "$cemuzip" -s'|[^/]*/||' -C $instdir bsdtar -xf "$cemuzip" -s'|[^/]*/||' -C $instdir
fi fi
if [ -f "$cemuhookzip" ]; then if [ -f "$cemuhookzip" ]; then
unzip -q -o "$cemuhookzip" -d $instdir unzip -q -o "$cemuhookzip" -d $instdir
fi fi
if [ -f "$gfxpackzip" ]; then if [ -f "$gfxpackzip" ]; then
rm -rf ${instdir}/graphicPacks/* #remove old versions of Graphic Packs to help with major changes rm -rf ${instdir}/graphicPacks/* #remove old versions of Graphic Packs to help with major changes
unzip -q -o "$gfxpackzip" -d ${instdir}/graphicPacks/ unzip -q -o "$gfxpackzip" -d ${instdir}/graphicPacks/
fi fi
if [ -f "$sharedFonts" ]; then if [ -f "$sharedFonts" ]; then
unzip -q -o "$sharedFonts" -d $instdir unzip -q -o "$sharedFonts" -d $instdir
fi fi
#Delete downloaded zips if applicable #Delete downloaded zips if applicable
if [ -f "gfxpacktemp.zip" ]; then if [ -f "gfxpacktemp.zip" ]; then
rm -rf gfxpacktemp.zip rm -rf gfxpacktemp.zip
fi fi
if [ -f "cemutemp.zip" ]; then if [ -f "cemutemp.zip" ]; then
rm -rf cemutemp.zip rm -rf cemutemp.zip
fi fi
if [ -f "cemuhooktemp.zip" ]; then if [ -f "cemuhooktemp.zip" ]; then
rm -rf cemuhooktemp.zip rm -rf cemuhooktemp.zip
fi fi
if [ -f "sharedFonts.zip" ]; then if [ -f "sharedFonts.zip" ]; then
rm -rf sharedFonts.zip rm -rf sharedFonts.zip
fi fi
#Configure wine prefix #Configure wine prefix
echo "Configuring new wine prefix" echo "Configuring new wine prefix"
export WINEPREFIX=$(realpath $instdir)/wine export WINEPREFIX=$(realpath $instdir)/wine
winetricks -q vcrun2017 winetricks -q vcrun2017
winetricks settings win7 winetricks settings win7