diff --git a/completions/pengwin-setup b/completions/pengwin-setup index e2ef5fe3..89f0c80f 100644 --- a/completions/pengwin-setup +++ b/completions/pengwin-setup @@ -21,7 +21,10 @@ function _pengwin_setup() { # By convention, the function name mapfile -t COMPREPLY < <(compgen -W 'PYENV PYTHONPIP POETRY' -- "${cur}") ;; SERVICES) - mapfile -t COMPREPLY < <(compgen -W 'RCLOCAL SSH' -- "${cur}") + mapfile -t COMPREPLY < <(compgen -W 'RCLOCAL SSH LAMP' -- "${cur}") + ;; + LAMP) + mapfile -t COMPREPLY < <(compgen -W 'BUILTIN 10.3 10.4 10.5 10.6' -- "${cur}") ;; SETTINGS) mapfile -t COMPREPLY < <(compgen -W 'EXPLORER COLORTOOL LANGUAGE SHELLS' -- "${cur}") diff --git a/pengwin-setup b/pengwin-setup index 6b047a19..f16b4d94 100755 --- a/pengwin-setup +++ b/pengwin-setup @@ -58,7 +58,9 @@ function check_upgrades() { else # Force iproute2 5.8 if [[ $( dpkg-query -s "iproute2" 2>/dev/null | grep -c "Version: 5\.8.*" ) == 0 ]]; then + sudo apt-mark unhold iproute2 sudo apt-get install -q -y --allow-downgrades iproute2=5.8.0-1 + sudo apt-mark hold iproute2 fi fi diff --git a/pengwin-setup.d/cloudcli.sh b/pengwin-setup.d/cloudcli.sh index 5fd5f251..bad0bf7c 100644 --- a/pengwin-setup.d/cloudcli.sh +++ b/pengwin-setup.d/cloudcli.sh @@ -133,10 +133,10 @@ function install_doctl() { function install_kubectl() { echo "Installing Helm" - curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash + curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash - wget https://raw.githubusercontent.com/helm/helm/master/scripts/completions.bash - sudo cp completions.bash /etc/bash_completion.d/helm_completions.bash + helm completion bash | sudo tee /etc/bash_completion.d/helm + helm completion fish >~/.config/fish/completions/helm.fish echo "Installing kubectl" curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - @@ -223,7 +223,7 @@ function install_kubernetes() { local kube_ctl="${wHome}/.kube/config" while [[ ! -f ${kube_ctl} ]]; do - if ! (whiptail --title "KUBERNETES" --yesno "Please enable Kubernetes in Docker Desktop. Would you like to try again?" 9 75); then + if ! (confirm --title "KUBERNETES" --yesno "Please enable Kubernetes in Docker Desktop. Would you like to try again?" 9 75); then return fi @@ -273,7 +273,7 @@ function install_openstack() { function main() { # shellcheck disable=SC2155 local choice=$( - whiptail --title "Cloud Management Menu" --checklist --separate-output "CLI tools for cloud management\n[SPACE to select, ENTER to confirm]:" 16 60 7 \ + menu --title "Cloud Management Menu" --checklist --separate-output "CLI tools for cloud management\n[SPACE to select, ENTER to confirm]:" 16 60 7 \ "AWS" "AWS CLI" off \ "AZURE" "Azure CLI" off \ "DO" "Digital Ocean CLI" off \ diff --git a/pengwin-setup.d/guilib.sh b/pengwin-setup.d/guilib.sh index 6dd7af7b..f9ead4bf 100644 --- a/pengwin-setup.d/guilib.sh +++ b/pengwin-setup.d/guilib.sh @@ -17,7 +17,7 @@ if (confirm --title "GUI Libraries" --yesno "Would you like to install a base se echo "Configuring dbus if you already had it installed. If not, you might see some errors, and that is okay." if [[ ${WIN_CUR_VER} -gt 17063 ]]; then - sudo rm /etc/dbus-1/session.conf + sudo rm -f /etc/dbus-1/session.conf sudo sed -i 's$.*$unix:tmpdir=/tmp$' /usr/share/dbus-1/session.conf sudo sed -i 's$ANONYMOUS$EXTERNAL$' /usr/share/dbus-1/session.conf sudo sed -i 's$$$' /usr/share/dbus-1/session.conf diff --git a/pengwin-setup.d/hidpi.sh b/pengwin-setup.d/hidpi.sh index 8d577469..01e09749 100644 --- a/pengwin-setup.d/hidpi.sh +++ b/pengwin-setup.d/hidpi.sh @@ -8,21 +8,33 @@ if (confirm --title "HiDPI" --yesno "Would you like to configure Qt and GTK for scale_factor=$(wslsys -S -s) sudo tee "/etc/profile.d/hidpi.sh" <= 2" | bc -l)" -eq 1 ]; then +if [ "\$(echo "\${scale_factor} >= 2" | bc -l)" -eq 1 ]; then export XCURSOR_SIZE=64 -elif [ "\$(echo "\${QT_SCALE_FACTOR} >= 1.5" | bc -l)" -eq 1 ]; then +elif [ "\$(echo "\${scale_factor} >= 1.5" | bc -l)" -eq 1 ]; then export XCURSOR_SIZE=32 else export XCURSOR_SIZE=16 fi +unset scale_factor + EOF + # add_fish_support 'hidpi' # not working with bass message --title "HiDPI" --msgbox "HiDPI has been adjusted to $(echo "${scale_factor} * 100 / 1" | bc)%. If you change your resolution run this option again to update your Linux applications." 10 80 diff --git a/pengwin-setup.d/lamp.sh b/pengwin-setup.d/lamp.sh index 68367dd4..b86bdfce 100644 --- a/pengwin-setup.d/lamp.sh +++ b/pengwin-setup.d/lamp.sh @@ -12,22 +12,35 @@ function install_lamp() { local menu_choice=$( menu --title "MariaDB" --radiolist "Choose what version of MariaDB you want to install\n[SPACE to select, ENTER to confirm]:" 14 65 5 \ - "10.2" "Install MariaDB 10.2 from MariaDB" off \ "10.3" "Install MariaDB 10.3 from MariaDB" off \ "10.4" "Install MariaDB 10.4 from MariaDB" off \ "10.5" "Install MariaDB 10.5 from MariaDB" off \ + "10.6" "Install MariaDB 10.6 from MariaDB" off \ "BUILTIN" "Install MariaDB from Debian Official Repo " off # shellcheck disable=SC2188 3>&1 1>&2 2>&3 ) + echo "Selected:" "${menu_choice}" echo "Installing MariaDB Database Server" - if [[ ${menu_choice} == "CANCELLED" ]] || [[ ${menu_choice} == "BUILTIN" ]]; then + if [[ ${menu_choice} == "CANCELLED" ]]; then + return 1 + fi + + # shellcheck disable=SC2155 + local selected_version=$(echo "${menu_choice##* }" | grep -E "10\.[1-6]?") + if [[ ${menu_choice} == *"BUILTIN"* ]]; then + + if [[ -n ${NON_INTERACTIVE} ]]; then + export DEBIAN_FRONTEND=noninteractive + fi + install_packages mariadb-server mariadb-client apt policy mariadb-server - else + + elif [[ -n ${selected_version} ]]; then if curl -sSO https://downloads.mariadb.com/MariaDB/mariadb-keyring-2019.gpg; then if curl -sS https://downloads.mariadb.com/MariaDB/mariadb-keyring-2019.gpg.sha256 | sha256sum -c --quiet; then echo 'Running apt-get update...' @@ -36,24 +49,32 @@ function install_lamp() { echo 'Done adding trusted package signing keys' else echo 'Failed to add trusted package signing keys' - exit 1 + return 1 fi else echo 'Failed to verify trusted package signing keys keyring file' - exit 1 + return 1 fi else echo 'Failed to download trusted package signing keys keyring file' fi - sudo apt-get -y -q install software-properties-common - sudo add-apt-repository "deb http://downloads.mariadb.com/MariaDB/mariadb-${menu_choice}/repo/debian buster main" + sudo apt-get -y -q install software-properties-common libdbi-perl + sudo add-apt-repository "deb http://downloads.mariadb.com/MariaDB/mariadb-${selected_version}/repo/debian buster main" sudo apt-get -q update - install_packages -t buster mariadb-server mariadb-client + + if [[ -n ${NON_INTERACTIVE} ]]; then + export DEBIAN_FRONTEND=noninteractive + sudo debconf-set-selections <<< "mariadb-server-${selected_version} mysql-server/root_password password PASS" + sudo debconf-set-selections <<< "mariadb-server-${selected_version} mysql-server/root_password_again password PASS" + fi + + install_packages -t buster mariadb-server mariadb-client mariadb-backup apt policy mariadb-server + else + echo "${menu_choice##* } was not found" + return 1 fi - service mariadb status - echo "Installing Apache Web Server" install_packages apache2 apache2-utils sudo service apache2 start @@ -109,6 +130,8 @@ fi EOF + /etc/profile.d/start-lamp.sh + else echo "Skipping SSH Server" fi diff --git a/pengwin-setup.d/nodejs.sh b/pengwin-setup.d/nodejs.sh index 0a48fdf6..d93fad32 100644 --- a/pengwin-setup.d/nodejs.sh +++ b/pengwin-setup.d/nodejs.sh @@ -19,7 +19,7 @@ echo "Offering user n / nvm version manager choice" menu_choice=$( menu --title "nodejs" --radiolist "Choose Node.js install method\n[SPACE to select, ENTER to confirm]:" 12 90 4 \ - "N" "Install with n version manager (fish shell compat. EXPERIMENTAL)" off \ + "NVERMAN" "Install with n version manager (fish shell compat. EXPERIMENTAL)" off \ "NVM" "Install with nvm version manager (fish shell compat. EXPERIMENTAL)" off \ "LATEST" "Install latest version via APT package manager" off \ "LTS" "Install LTS version via APT package manager" off @@ -73,7 +73,7 @@ EOF eval "$(cat "${NPM_WIN_PROFILE}")" fi -if [[ ${menu_choice} == *"N"* ]]; then +if [[ ${menu_choice} == *"NVERMAN"* ]]; then echo "Ensuring we have build-essential installed" sudo apt-get -y -q install build-essential @@ -118,9 +118,11 @@ EOF # Add npm to bash completion sudo mkdir -p /etc/bash_completion.d npm completion | sudo tee /etc/bash_completion.d/npm + + touch "${HOME}"/.should-restart elif [[ ${menu_choice} == *"NVM"* ]]; then echo "Installing nvm, Node.js version manager" - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash # Set NVM_DIR variable and load nvm NVM_PATH="$(cat ${HOME}/.bashrc | grep '^export NVM_DIR=')" @@ -171,10 +173,12 @@ EOF # Add npm to bash completion npm completion | sudo tee /etc/bash_completion.d/npm + + touch "${HOME}"/.should-restart elif [[ ${menu_choice} == *"LATEST"* ]]; then echo "Installing latest node.js version from NodeSource repository" - major_vers=15 + major_vers=16 nodesrc_url="https://deb.nodesource.com/setup_${major_vers}.x" #curl -sL "$nodesrc_url" -o repo-install.sh #sudo bash repo-install.sh diff --git a/pengwin-setup.d/pythonpi.sh b/pengwin-setup.d/pythonpi.sh index a933545f..5ca14243 100644 --- a/pengwin-setup.d/pythonpi.sh +++ b/pengwin-setup.d/pythonpi.sh @@ -16,32 +16,37 @@ function install_pyenv() { if [[ -f "${HOME}"/.bashrc && $(grep -c '^[^#]*\bPATH.*/.pyenv/bin' "${HOME}"/.bashrc) == 0 ]]; then echo "" >>"${HOME}"/.bashrc - echo "export PATH=\"\${HOME}/.pyenv/bin:\${PATH}\"" >>"${HOME}"/.bashrc + echo "export PYENV_ROOT=\"\${HOME}/.pyenv\"" >>"${HOME}"/.bashrc + echo "export PATH=\"\${PYENV_ROOT}/bin:\${PATH}\"" >>"${HOME}"/.bashrc + echo "eval \"\$(pyenv init --path)\"" >>"${HOME}"/.bashrc echo "eval \"\$(pyenv init -)\"" >>"${HOME}"/.bashrc - echo "eval \"\$(pyenv virtualenv-init -)\"" >>"${HOME}"/.bashrc fi if [[ -f "${HOME}"/.zshrc && $(grep -c '^[^#]*\bPATH.*/.pyenv/bin' "${HOME}"/.zshrc) == 0 ]]; then echo "" >>"${HOME}"/.zshrc - echo "export PATH=\"${HOME}/.pyenv/bin:\$PATH\"" >>"${HOME}"/.zshrc + echo "export PYENV_ROOT=\"\${HOME}/.pyenv\"" >>"${HOME}"/.zshrc + echo "export PATH=\"\${PYENV_ROOT}/bin:\${PATH}\"" >>"${HOME}"/.zshrc + echo "eval \"\$(pyenv init --path)\"" >>"${HOME}"/.zshrc echo "eval \"\$(pyenv init -)\"" >>"${HOME}"/.zshrc - echo "eval \"\$(pyenv virtualenv-init -)\"" >>"${HOME}"/.zshrc fi # shellcheck disable=SC2002 if [[ -d "${HOME}"/.config/fish && $(cat "${HOME}"/.config/fish/config.fish 2>/dev/null | grep -c '^[^#]*\bPATH.*/.pyenv/bin') == 0 ]]; then echo "" >>"${HOME}"/.config/fish/config.fish - echo "set -x PATH \"${HOME}/.pyenv/bin\" \$PATH" >>"${HOME}"/.config/fish/config.fish + echo "set -x PYENV_ROOT \"${HOME}/.pyenv\"" >>"${HOME}"/.config/fish/config.fish + echo "set -x PATH \"${PYENV_ROOT}/bin\" \$PATH" >>"${HOME}"/.config/fish/config.fish + echo 'status --is-interactive; and pyenv init --path| source' >>"${HOME}"/.config/fish/config.fish echo 'status --is-interactive; and pyenv init -| source' >>"${HOME}"/.config/fish/config.fish - echo 'status --is-interactive; and pyenv virtualenv-init -| source' >>"${HOME}"/.config/fish/config.fish fi - echo "installing Python 3.9" - export PATH="${HOME}/.pyenv/bin:$PATH" + echo "Installing Python 3.9" + export PYENV_ROOT="$HOME/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init --path)" eval "$(pyenv init -)" - eval "$(pyenv virtualenv-init -)" - pyenv install -s 3.9.4 - pyenv global 3.9.4 + + pyenv install -s 3.9.6 + pyenv global 3.9.6 touch "${HOME}"/.should-restart @@ -99,6 +104,8 @@ function main() { 3>&1 1>&2 2>&3 ) + echo "Selected:" "${menu_choice}" + if [[ ${menu_choice} == "CANCELLED" ]]; then return 1 fi diff --git a/pengwin-setup.d/uninstall/guilib.sh b/pengwin-setup.d/uninstall/guilib.sh index d26c8639..1eb828f6 100644 --- a/pengwin-setup.d/uninstall/guilib.sh +++ b/pengwin-setup.d/uninstall/guilib.sh @@ -11,6 +11,7 @@ function main() { sudo_rem_file "/etc/dbus-1/session.conf" sudo_rem_file "/usr/share/dbus-1/session.conf" sudo_rem_file "/etc/profile.d/dbus.sh" + sudo_rem_file "${__fish_sysconf_dir:=/etc/fish/conf.d}/dbus.fish" remove_package xclip gnome-themes-standard gtk2-engines-murrine dbus dbus-x11 mesa-utils libqt5core5a binutils libnss3 libegl1-mesa } diff --git a/pengwin-setup.d/uninstall/hidpi.sh b/pengwin-setup.d/uninstall/hidpi.sh index 92bf15d0..d95e45e8 100644 --- a/pengwin-setup.d/uninstall/hidpi.sh +++ b/pengwin-setup.d/uninstall/hidpi.sh @@ -7,6 +7,7 @@ function main() { echo "Uninstalling Qt and GTK HiDPI modifications" sudo_rem_file "/etc/profile.d/hidpi.sh" + sudo_rem_file "${__fish_sysconf_dir:=/etc/fish/conf.d}/hidpi.fish" } diff --git a/pengwin-setup.d/uninstall/lamp.sh b/pengwin-setup.d/uninstall/lamp.sh index 571fb6e4..36d35423 100644 --- a/pengwin-setup.d/uninstall/lamp.sh +++ b/pengwin-setup.d/uninstall/lamp.sh @@ -3,24 +3,24 @@ # shellcheck source=./uninstall-common.sh source "$(dirname "$0")/uninstall-common.sh" "$@" -function main() -{ +function main() { -echo "Uninstalling LAMP stack" + echo "Uninstalling LAMP stack" -sudo_rem_file "/etc/profile.d/start-lamp.sh" -sudo_rem_file "/etc/sudoers.d/start-lamp" + sudo_rem_file "/etc/profile.d/start-lamp.sh" + sudo_rem_file "/etc/sudoers.d/start-lamp" -sudo_rem_file "/usr/bin/start-lamp" + sudo_rem_file "/usr/bin/start-lamp" -remove_package "mariadb-server" "mariadb-client" "apache2" "apache2-utils" "php" "libapache2-mod-php" "php-cli" "php-fpm" "php-json" "php-pdo" "php-mysql" "php-zip" "php-gd" "php-mbstring" "php-curl" "php-xml" "php-pear" "php-bcmath" + remove_package "mariadb-server" "mariadb-client" "mariadb-backup" "apache2" "apache2-utils" "php" "libapache2-mod-php" "php-cli" "php-fpm" "php-json" "php-pdo" "php-mysql" "php-zip" "php-gd" "php-mbstring" "php-curl" "php-xml" "php-pear" "php-bcmath" "libdbi-perl" -sudo sed -i '/mariadb/d' /etc/apt/sources.list -sudo_rem_file "/etc/apt/trusted.gpg.d/mariadb-keyring-2019.gpg" -sudo_rem_file "/var/www/html/phpinfo.php" + sudo sed -i '/mariadb/d' /etc/apt/sources.list + sudo_rem_file "/etc/apt/trusted.gpg.d/mariadb-keyring-2019.gpg" + sudo_rem_file "/var/www/html/phpinfo.php" + sudo apt-get autoremove } -if show_warning "LAMP stack" "$@" ; then - main "$@" +if show_warning "LAMP stack" "$@"; then + main "$@" fi diff --git a/pengwin-setup.d/uninstall/pyenv.sh b/pengwin-setup.d/uninstall/pyenv.sh index cc3f575d..14601b37 100644 --- a/pengwin-setup.d/uninstall/pyenv.sh +++ b/pengwin-setup.d/uninstall/pyenv.sh @@ -3,9 +3,13 @@ # shellcheck source=./uninstall-common.sh source "$(dirname "$0")/uninstall-common.sh" "$@" -line_rgx='^[^#]*\bPATH.*/.pyenv/bin' -line2_rgx='^[^#]*\bpyenv init -' -line3_rgx='^[^#]*\bpyenv virtualenv-init -' +line_rgx='^[^#]*\bPYENV_ROOT.*/.pyenv' +line2_rgx='^[^#]*\bPATH.*PYENV_ROOT.*/bin' +line3_rgx='^[^#]*\bpyenv init --path' +line4_rgx='^[^#]*\bpyenv init -' +line5_rgx='^[^#]*\bPATH.*/.pyenv/bin' +line6_rgx='^[^#]*\bpyenv virtualenv-init -' + function multiclean_file() { @@ -14,6 +18,9 @@ function multiclean_file() { clean_file "$1" "$line_rgx" clean_file "$1" "$line2_rgx" clean_file "$1" "$line3_rgx" + clean_file "$1" "$line4_rgx" + clean_file "$1" "$line5_rgx" + clean_file "$1" "$line6_rgx" fi } diff --git a/pengwin-setup.d/uninstall/vcxsrv.sh b/pengwin-setup.d/uninstall/vcxsrv.sh index deb88a53..01a04d41 100644 --- a/pengwin-setup.d/uninstall/vcxsrv.sh +++ b/pengwin-setup.d/uninstall/vcxsrv.sh @@ -24,6 +24,7 @@ function main() { echo "Removing PATH modifier..." sudo_rem_file "/etc/profile.d/01-vcxsrv.sh" + sudo_rem_file "${__fish_sysconf_dir:=/etc/fish/conf.d}/01-vcxsrv.fish" } diff --git a/pengwin-setup.d/uninstall/x410.sh b/pengwin-setup.d/uninstall/x410.sh index 0e69f243..baca979a 100644 --- a/pengwin-setup.d/uninstall/x410.sh +++ b/pengwin-setup.d/uninstall/x410.sh @@ -6,6 +6,7 @@ source "$(dirname "$0")/uninstall-common.sh" "$@" function main() { echo "Removing PATH modifier..." sudo_rem_file "/etc/profile.d/02-x410.sh" + sudo_rem_file "${__fish_sysconf_dir:=/etc/fish/conf.d}/02-x410.fish" } if show_warning "x410" "$@"; then diff --git a/pengwin-setup.d/vcxsrv.sh b/pengwin-setup.d/vcxsrv.sh index 02ff99c9..65636832 100644 --- a/pengwin-setup.d/vcxsrv.sh +++ b/pengwin-setup.d/vcxsrv.sh @@ -12,44 +12,60 @@ if (confirm --title "VCXSRV" --yesno "Would you like to install the VcXsrv X-ser echo "Installing required install dependencies" install_packages wget unzip p7zip-full mesa-utils + createtmp + + echo "Downloading VcxSrv installer" + wget -O vcxsrvinstaller.exe "$VcxsrvUrl" + wVcxsrvDir="$(cmd-exe /C "echo %USERPROFILE%\.vcxsrv" | tr -d '\r')" VcxsrvDir="$(wslpath "${wVcxsrvDir}")" - if [[ ! -d "${VcxsrvDir}" ]]; then - createtmp - echo "Creating vcxsrv install directory: $VcxsrvDir" - mkdir -p "${VcxsrvDir}" - - echo "Downloading VcxSrv installer" - wget -O vcxsrvinstaller.exe "$VcxsrvUrl" - - echo "Unpacking installer executable" - mkdir vcxsrv - 7z x vcxsrvinstaller.exe -o"${VcxsrvDir}" - - cleantmp - else - echo "${VcxsrvDir} already exists, leaving in place." - echo "To reinstall VcXsrv, please delete ${VcxsrvDir} and run this installer again" + + if [[ -d "${VcxsrvDir}" ]]; then + echo "Uninstalling previous version" + if cmd-exe /C tasklist | grep -Fq 'vcxsrv.exe'; then + echo "vcxsrv.exe running. Killing process..." + cmd-exe /C taskkill /IM 'vcxsrv.exe' /F + fi + + # now safe to delete + rm -rf "${VcxsrvDir}" fi + + echo "Creating vcxsrv install directory: $VcxsrvDir" + mkdir -p "${VcxsrvDir}" + + echo "Unpacking installer executable" + mkdir vcxsrv + 7z x vcxsrvinstaller.exe -o"${VcxsrvDir}" + + cleantmp echo "Configuring VcxSrv to start on Pengwin launch" sudo bash -c 'cat > /etc/profile.d/01-vcxsrv.sh' < /dev/null &) +if [ -n "\${WSL2}" ]; then + (cmd.exe /V /C "set __COMPAT_LAYER=HighDpiAware&& ${wVcxsrvDir}\vcxsrv.exe" :0 -silent-dup-error -multiwindow -nowgl -ac >/dev/null 2>&1 &) else - (cmd.exe /C "${wVcxsrvDir}\vcxsrv.exe" :0 -silent-dup-error -multiwindow -nowgl &> /dev/null &) + (cmd.exe /V /C "set __COMPAT_LAYER=HighDpiAware&& ${wVcxsrvDir}\vcxsrv.exe" :0 -silent-dup-error -multiwindow -nowgl >/dev/null 2>&1 &) fi + +export XRANDRDPI=\$(timeout 2s xdpyinfo | grep resolution | sed "s/.*resolution:[ ]*\([0-9]*\)x.*/\1/") +export VCXSRV=yes + EOF + #add_fish_support '01-vcxsrv' unset version unset VcxsrvUrl unset wVcxsrvDir unset VcxsrvDir - + # Avoid collision with the other XServer sudo rm -f /etc/profile.d/02-x410.sh + sudo rm -f "${__fish_sysconf_dir:=/etc/fish/conf.d}/02-x410.fish" + + source /etc/profile.d/01-vcxsrv.sh touch "${HOME}"/.should-restart else diff --git a/pengwin-setup.d/x410.sh b/pengwin-setup.d/x410.sh index b18a8417..07d42732 100644 --- a/pengwin-setup.d/x410.sh +++ b/pengwin-setup.d/x410.sh @@ -16,9 +16,15 @@ else (cmd-exe /c x410.exe /wm &> /dev/null &) fi +export X410=yes + EOF + #add_fish_support '02-x410' + # Avoid collision with the other XServer sudo rm -f /etc/profile.d/01-vcxsrv.sh + sudo rm -f "${__fish_sysconf_dir:=/etc/fish/conf.d}/01-vcxsrv.fish" + touch "${HOME}"/.should-restart else diff --git a/tests/commons.sh b/tests/commons.sh index 367ccdca..fba77251 100755 --- a/tests/commons.sh +++ b/tests/commons.sh @@ -36,7 +36,7 @@ function oneTimeTearDown() { function package_installed() { # shellcheck disable=SC2155 - local result=$(apt -qq list "$1" 2>/dev/null | grep -c "\[install") # so it matches english "install" and also german "installiert" + local result=$(apt -qq list "$1" 2>/dev/null | grep -c "\[install\|\[upgradable") # so it matches english "install" and also german "installiert" if [[ $result == 0 ]]; then return 1 diff --git a/tests/hidpi.sh b/tests/hidpi.sh index 102967c4..c6c8d094 100755 --- a/tests/hidpi.sh +++ b/tests/hidpi.sh @@ -7,7 +7,7 @@ function testDPI() { local scale_factor=$(wslsys -S -s) run_pengwinsetup autoinstall GUI HIDPI - assertEquals QT_SCALE_FACTOR "1" "$(grep -c "QT_SCALE_FACTOR=${scale_factor}" /etc/profile.d/hidpi.sh)" + assertEquals scale_factor "1" "$(grep -c "scale_factor=${scale_factor}" /etc/profile.d/hidpi.sh)" } function testUninstall() { diff --git a/tests/lamp.sh b/tests/lamp.sh new file mode 100644 index 00000000..95aec62e --- /dev/null +++ b/tests/lamp.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +source commons.sh +source mocks.sh + +mariadb_version="${1:-BUILTIN}" +shift + +function testLAMP() { + + run_pengwinsetup install SERVICES LAMP "${mariadb_version}" + + for i in 'mariadb-server' 'mariadb-client' 'apache2' 'php' 'libdbi-perl'; do + package_installed $i + assertTrue "package $i is not installed" "$?" + done + +} + +function testUninstall() { + run_pengwinsetup uninstall LAMP + + for i in 'mariadb-server' 'mariadb-client' 'apache2' 'php' 'libdbi-perl'; do + package_installed $i + assertFalse "package $i is not uninstalled" "$?" + done + +} + +# shellcheck disable=SC1091 +source shunit2 diff --git a/tests/pythonpi.sh b/tests/pythonpi.sh index d408cdee..0d5ae7d9 100644 --- a/tests/pythonpi.sh +++ b/tests/pythonpi.sh @@ -12,7 +12,8 @@ function testPyEnv() { done assertEquals "Python was not installed" "1" "$(run_command_as_testuser "${HOME}"/.pyenv/shims/python3 --version | grep -c '3.9')" - assertEquals "Pyenv variables are not setup" "1" "$(grep -c '^[^#]*\bPATH.*/.pyenv/bin' "${HOME}"/.bashrc)" + assertEquals "Pyenv variables are not setup" "1" "$(grep -c '^[^#]*\bPYENV_ROOT.*/.pyenv' "${HOME}"/.bashrc)" + assertEquals "Pyenv variables are not setup" "1" "$(grep -c '^[^#]*\bPATH.*PYENV_ROOT.*/bin' "${HOME}"/.bashrc)" } @@ -22,7 +23,8 @@ function testUninstallPyEnv() { test -f "${HOME}"/.pyenv/shims/python3 assertFalse "Python was not uninstalled" "$?" - assertEquals "Pyenv variables were not cleaned up" "0" "$(grep -c '^[^#]*\bPATH.*/.pyenv/bin' "${HOME}"/.bashrc)" + assertEquals "Pyenv variables were not cleaned up" "0" "$(grep -c '^[^#]*\bPYENV_ROOT.*/.pyenv' "${HOME}"/.bashrc)" + assertEquals "Pyenv variables were not cleaned up" "0" "$(grep -c '^[^#]*\bPATH.*PYENV_ROOT.*/bin' "${HOME}"/.bashrc)" } # shellcheck disable=SC1091 diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 11644803..2a14f888 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -21,8 +21,10 @@ if [ -z "${CIRCLE_NODE_TOTAL}" ]; then run_test ./dotnet.sh run_test ./brew.sh run_test ./guilib.sh + run_test ./lamp.sh "10.6" elif [[ ${CIRCLE_NODE_INDEX} == 0 ]]; then run_test ./pythonpi.sh + run_test ./lamp.sh "BUILTIN" elif [[ ${CIRCLE_NODE_INDEX} == 1 ]]; then run_test ./fish.sh run_test ./x410.sh @@ -31,11 +33,14 @@ elif [[ ${CIRCLE_NODE_INDEX} == 1 ]]; then run_test ./hidpi.sh run_test ./ansible.sh run_test ./java.sh + run_test ./lamp.sh "10.4" elif [[ ${CIRCLE_NODE_INDEX} == 2 ]]; then run_test ./brew.sh + run_test ./lamp.sh "10.3" elif [[ ${CIRCLE_NODE_INDEX} == 3 ]]; then run_test ./dotnet.sh run_test ./guilib.sh run_test ./go.sh run_test ./jetbrains-support.sh + run_test ./lamp.sh "10.6" fi