diff --git a/debian/dxvkroot/dxvkbuild.sh b/debian/dxvkroot/dxvkbuild.sh index a245faf..7abf632 100755 --- a/debian/dxvkroot/dxvkbuild.sh +++ b/debian/dxvkroot/dxvkbuild.sh @@ -228,16 +228,20 @@ tempLinks=( function runtimeCheck() { + local pkgreq_name + local known_pkgs + local pkglist + # Friendly name for this package - local pkgreq_name=${1} + pkgreq_name=${1} # Known package names to check on Debian - local known_pkgs=${2} + known_pkgs=${2} # Check if any of these Wine packages are present on the system i=0 for pkg in ${known_pkgs[@]}; do if [[ $(echo $(dpkg -s ${pkg} &>/dev/null)$?) -eq 0 ]]; then - local pkglist[$i]=${pkg} + pkglist[$i]=${pkg} let i++ fi done @@ -293,9 +297,13 @@ fi function pkgcompilecheck() { - local install_function=${1} - local pkg=${2} - local pkg_data=${3} + local install_function + local pkg + local pkg_data + + install_function=${1} + pkg=${2} + pkg_data=${3} if [[ $(echo $(dpkg -s ${pkg} &>/dev/null)$?) -ne 0 ]] || [[ -v UPDATE_OVERRIDE ]]; then ${install_function} ${pkg_data} @@ -312,7 +320,9 @@ function pkgcompilecheck() { function dxvk_install_custom() { - local PATCHDIR="${1}" + local PATCHDIR + + PATCHDIR="${1}" # Use posix alternates for MinGW binaries function dxvk_posixpkgs() { @@ -346,15 +356,19 @@ function dxvk_install_custom() { # Add and apply custom DXVK patches function dxvk_custompatches() { + local CURDIR + local dxvk_builddir_name + local dxvk_builddir_path + # Get our current directory, since we will change it during patching process below # We want to go back here after having applied the patches - local CURDIR="${PWD}" + CURDIR="${PWD}" # Check if the following folder exists, and proceed. if [[ -d "${DXVKROOT}/../../${PATCHDIR}" ]]; then cp -r "${DXVKROOT}/../../${PATCHDIR}/"*.{patch,diff} "${DXVKROOT}/${pkg_name}/" 2>/dev/null - local dxvk_builddir_name=$(ls -l "${DXVKROOT}/${pkg_name}" | grep ^d | awk '{print $NF}') + dxvk_builddir_name=$(ls -l "${DXVKROOT}/${pkg_name}" | grep ^d | awk '{print $NF}') # TODO Expecting just one folder here. This method doesn't work with multiple dirs present if [[ $(echo ${dxvk_builddir_name} | wc -l) -gt 1 ]]; then @@ -362,7 +376,7 @@ function dxvk_install_custom() { exit 1 fi - local dxvk_builddir_path="${DXVKROOT}/${pkg_name}/${dxvk_builddir_name}" + dxvk_builddir_path="${DXVKROOT}/${pkg_name}/${dxvk_builddir_name}" cd "${dxvk_builddir_path}" for pfile in ../*.{patch,diff}; do @@ -433,16 +447,21 @@ function compile_and_install_deb() { function arrayparser_reverse() { - local arrays=( + local arrays + local s + local IFS + local y + + arrays=( '_pkg_deps_build' '_pkg_deps_runtime' ) for w in ${arrays[@]}; do - local s=\${${w}} + s=\${${w}} - local IFS='|' - local y=0 + IFS='|' + y=0 for t in $(eval printf '%s\|' ${s}); do eval ${w}[$y]=\"${t}\" @@ -472,18 +491,27 @@ function compile_and_install_deb() { function pkg_dependencies() { - local _pkg_list="${1}" - local _pkg_type="${2}" - local IFS=$'\n' + local _pkg_list + local _pkg_type + local _pkg_type_str + local a + local b + local _validlist + local IFS + + _pkg_list="${1}" + _pkg_type="${2}" + + IFS=$'\n' _pkg_list=$(echo "${_pkg_list}" | sed 's/([^)]*)//g') unset IFS case ${_pkg_type} in buildtime) - local _pkg_type_str="build time" + _pkg_type_str="build time" ;; runtime) - local _pkg_type_str="runtime" + _pkg_type_str="runtime" ;; esac @@ -492,10 +520,10 @@ function compile_and_install_deb() { fi # Generate a list of missing dependencies - local a=0 + a=0 for p in ${_pkg_list[@]}; do if [[ $(pkg_installcheck ${p})$? -eq 0 ]]; then - local _validlist[$a]=${p} + _validlist[$a]=${p} let a++ # Global array to track installed build dependencies @@ -526,7 +554,7 @@ function compile_and_install_deb() { } # Install missing dependencies, be informative - local b=0 + b=0 for _pkg_dep in ${_validlist[@]}; do echo -e "$(( $b + 1 ))/$(( ${#_validlist[*]} )) - Installing ${_pkg_name} ${_pkg_type_str} dependency ${_pkg_dep}" @@ -610,8 +638,11 @@ function compile_and_install_deb() { function pkg_override_debianfile() { - local contents=${1} - local targetfile=${2} + local contents + local targetfile + + contents=${1} + targetfile=${2} if [[ ${contents} != "empty" ]]; then echo "${contents}" > "${targetfile}" @@ -749,8 +780,10 @@ function buildpkg_removal() { function pkg_install_main() { + local pkg_datafile + # Read necessary variables from debdata file - local pkg_datafile=${1} + pkg_datafile=${1} if [[ -f ${pkg_datafile} ]]; then source ${pkg_datafile} @@ -765,7 +798,12 @@ function pkg_install_main() { # Separate each array index with | in these arrays function pkg_arrayparser() { - local pkg_arrays=( + local pkg_arrays + local IFS + local s + local t + + pkg_arrays=( 'pkg_deps_build' 'pkg_deps_runtime' ) @@ -774,8 +812,8 @@ function pkg_install_main() { for w in ${pkg_arrays[@]}; do - local s=\${${w}[@]} - local t=$(eval printf '%s\|' ${s}) + s=\${${w}[@]} + t=$(eval printf '%s\|' ${s}) unset ${w} eval ${w}=\"${t}\" diff --git a/debian/updatewine_debian.sh b/debian/updatewine_debian.sh index 09fdc73..f6d74e5 100755 --- a/debian/updatewine_debian.sh +++ b/debian/updatewine_debian.sh @@ -153,7 +153,9 @@ function mainQuestions() { # TODO: remove duplicate functionality. This function is defined in updatewine.sh function questionresponse() { - local response=${1} + local response + + response=${1} read -r -p "" response if [[ $(echo $response | sed 's/ //g') =~ ^([yY][eE][sS]|[yY])$ ]]; then diff --git a/debian/wineroot/winebuild.sh b/debian/wineroot/winebuild.sh index ddde407..ca0dbf6 100755 --- a/debian/wineroot/winebuild.sh +++ b/debian/wineroot/winebuild.sh @@ -406,8 +406,11 @@ function girl_check() { function getWine() { - local winesrc_url="${git_source_wine}" - local winestagingsrc_url="${git_source_winestaging}" + local winesrc_url + local winestagingsrc_url + + winesrc_url="${git_source_wine}" + winestagingsrc_url="${git_source_winestaging}" function cleanOldBuilds() { if [[ $(find "${BUILDROOT}" -type d -name "winebuild_*" | wc -l) -ne 0 ]]; then @@ -462,7 +465,9 @@ function getWine() { function getDebianFiles() { - local debian_archive=wine_3.0-1ubuntu1.debian.tar.xz + local debian_archive + + debian_archive=wine_3.0-1ubuntu1.debian.tar.xz cd "${WINEDIR}" wget http://archive.ubuntu.com/ubuntu/pool/universe/w/wine/${debian_archive} @@ -490,6 +495,9 @@ function check_gitOverride() { function form_commit_array() { + local array_name + local commits_raw + cd "${commit_dir}" if [[ $? -ne 0 ]]; then @@ -497,8 +505,8 @@ function check_gitOverride() { exit 1 fi - local array_name=${1} - local commits_raw=$(eval ${2}) + array_name=${1} + commits_raw=$(eval ${2}) local i=0 for commit in ${commits_raw[*]}; do @@ -517,13 +525,20 @@ function check_gitOverride() { function staging_change_freeze_commit() { - local wine_commits_raw="git log --pretty=oneline | awk '{print \$1}' | tr '\n' ' '" + local wine_commits_raw + local staging_refcommits_raw + local staging_rebasecommits_raw + local i + local k + local wine_dropcommits + + wine_commits_raw="git log --pretty=oneline | awk '{print \$1}' | tr '\n' ' '" # TODO this check may break quite easily # It depends on the exact comment syntax Wine Staging developers are using (Rebase against ...) # Length and order of these two "array" variables MUST MATCH! - local staging_refcommits_raw="git log --pretty=oneline | awk '{ if ((length(\$NF)==40 || length(\$NF)==41) && \$(NF-1)==\"against\") print \$1; }'" - local staging_rebasecommits_raw="git log --pretty=oneline | awk '{ if ((length(\$NF)==40 || length(\$NF)==41) && \$(NF-1)==\"against\") print substr(\$NF,1,40); }' | tr '\n' ' '" + staging_refcommits_raw="git log --pretty=oneline | awk '{ if ((length(\$NF)==40 || length(\$NF)==41) && \$(NF-1)==\"against\") print \$1; }'" + staging_rebasecommits_raw="git log --pretty=oneline | awk '{ if ((length(\$NF)==40 || length(\$NF)==41) && \$(NF-1)==\"against\") print substr(\$NF,1,40); }' | tr '\n' ' '" # Syntax: commit_dir="${WINEDIR}" @@ -541,12 +556,12 @@ function check_gitOverride() { # Filter all newer than defined in 'git_commithash_wine' # echo -e "Determining valid Wine Staging git commit. This takes a while.\n" - local i=0 + i=0 for dropcommit in ${wine_commits[@]}; do if [[ "${dropcommit}" == "${git_commithash_wine}" ]]; then break else - local wine_dropcommits[$i]="${dropcommit}" + wine_dropcommits[$i]="${dropcommit}" let i++ fi done @@ -555,7 +570,7 @@ function check_gitOverride() { # For the filtered array list, iterate through 'staging_rebasecommits' array list until # we get a match for vanilla_commit in ${wine_commits[@]}; do - local k=0 + k=0 for rebase_commit in ${staging_rebasecommits[@]}; do if [[ "${vanilla_commit}" == "${rebase_commit}" ]]; then # This is the commit we use for vanilla Wine @@ -587,19 +602,26 @@ z=0 function WineDeps() { - local method=${1} - local deps="${2}" - local depsname=${3} - local pkgtype=${4} + local method + local deps + local depsname + local pkgtype + local str + local mgrcmd + + method=${1} + deps="${2}" + depsname=${3} + pkgtype=${4} case ${method} in install) - local str="Installing" - local mgrcmd="sudo apt install -y" + str="Installing" + mgrcmd="sudo apt install -y" ;; remove) - local str="Removing" - local mgrcmd="sudo apt purge --remove -y" + str="Removing" + mgrcmd="sudo apt purge --remove -y" ;; *) echo -e "\e[1mERROR:\e[0m Unknown package management input method. Aborting\n" @@ -611,26 +633,32 @@ function WineDeps() { # Check and install/remove package related dependencies if they are missing/installed function pkgdependencies() { - local deplist="${1}" + local deplist + local checkstatus + local a + local b + local validlist + + deplist="${1}" # Get a valid logic for generating 'list' array below case ${method} in install) # Package is not installed, install it - local checkstatus=0 + checkstatus=0 ;; remove) # Package is installed, remove it - local checkstatus=1 + checkstatus=1 ;; esac # Generate a list of missing/removable dependencies, depending on the logic - local a=0 + a=0 for p in ${deplist[@]}; do pf=$(printf "%s" ${p} | sed -r 's/^(.*)\|.*/\1/') if [[ $(echo $(dpkg -s ${pf} &>/dev/null)$?) -ne ${checkstatus} ]]; then - local validlist[$a]=${p} + validlist[$a]=${p} let a++ # Global array to track installed build dependencies @@ -643,7 +671,7 @@ function WineDeps() { done # Install missing/Remove existing dependencies, be informative - local b=0 + b=0 for pkgdep in ${validlist[@]}; do optional=0