Skip to content

Commit dca38b3

Browse files
authored
Merge pull request #345 from WhitewaterFoundry/development
Development
2 parents 4db15e1 + 072c1fa commit dca38b3

File tree

21 files changed

+200
-78
lines changed

21 files changed

+200
-78
lines changed

completions/pengwin-setup

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ function _pengwin_setup() { # By convention, the function name
2121
mapfile -t COMPREPLY < <(compgen -W 'PYENV PYTHONPIP POETRY' -- "${cur}")
2222
;;
2323
SERVICES)
24-
mapfile -t COMPREPLY < <(compgen -W 'RCLOCAL SSH' -- "${cur}")
24+
mapfile -t COMPREPLY < <(compgen -W 'RCLOCAL SSH LAMP' -- "${cur}")
25+
;;
26+
LAMP)
27+
mapfile -t COMPREPLY < <(compgen -W 'BUILTIN 10.3 10.4 10.5 10.6' -- "${cur}")
2528
;;
2629
SETTINGS)
2730
mapfile -t COMPREPLY < <(compgen -W 'EXPLORER COLORTOOL LANGUAGE SHELLS' -- "${cur}")

pengwin-setup

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ function check_upgrades() {
5858
else
5959
# Force iproute2 5.8
6060
if [[ $( dpkg-query -s "iproute2" 2>/dev/null | grep -c "Version: 5\.8.*" ) == 0 ]]; then
61+
sudo apt-mark unhold iproute2
6162
sudo apt-get install -q -y --allow-downgrades iproute2=5.8.0-1
63+
sudo apt-mark hold iproute2
6264
fi
6365

6466
fi

pengwin-setup.d/cloudcli.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ function install_doctl() {
133133
function install_kubectl() {
134134

135135
echo "Installing Helm"
136-
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
136+
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
137137

138-
wget https://raw.githubusercontent.com/helm/helm/master/scripts/completions.bash
139-
sudo cp completions.bash /etc/bash_completion.d/helm_completions.bash
138+
helm completion bash | sudo tee /etc/bash_completion.d/helm
139+
helm completion fish >~/.config/fish/completions/helm.fish
140140

141141
echo "Installing kubectl"
142142
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
@@ -223,7 +223,7 @@ function install_kubernetes() {
223223
local kube_ctl="${wHome}/.kube/config"
224224

225225
while [[ ! -f ${kube_ctl} ]]; do
226-
if ! (whiptail --title "KUBERNETES" --yesno "Please enable Kubernetes in Docker Desktop. Would you like to try again?" 9 75); then
226+
if ! (confirm --title "KUBERNETES" --yesno "Please enable Kubernetes in Docker Desktop. Would you like to try again?" 9 75); then
227227
return
228228

229229
fi
@@ -273,7 +273,7 @@ function install_openstack() {
273273
function main() {
274274
# shellcheck disable=SC2155
275275
local choice=$(
276-
whiptail --title "Cloud Management Menu" --checklist --separate-output "CLI tools for cloud management\n[SPACE to select, ENTER to confirm]:" 16 60 7 \
276+
menu --title "Cloud Management Menu" --checklist --separate-output "CLI tools for cloud management\n[SPACE to select, ENTER to confirm]:" 16 60 7 \
277277
"AWS" "AWS CLI" off \
278278
"AZURE" "Azure CLI" off \
279279
"DO" "Digital Ocean CLI" off \

pengwin-setup.d/guilib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (confirm --title "GUI Libraries" --yesno "Would you like to install a base se
1717

1818
echo "Configuring dbus if you already had it installed. If not, you might see some errors, and that is okay."
1919
if [[ ${WIN_CUR_VER} -gt 17063 ]]; then
20-
sudo rm /etc/dbus-1/session.conf
20+
sudo rm -f /etc/dbus-1/session.conf
2121
sudo sed -i 's$<listen>.*</listen>$<listen>unix:tmpdir=/tmp</listen>$' /usr/share/dbus-1/session.conf
2222
sudo sed -i 's$<auth>ANONYMOUS</auth>$<auth>EXTERNAL</auth>$' /usr/share/dbus-1/session.conf
2323
sudo sed -i 's$<allow_anonymous/></busconfig>$</busconfig>$' /usr/share/dbus-1/session.conf

pengwin-setup.d/hidpi.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,33 @@ if (confirm --title "HiDPI" --yesno "Would you like to configure Qt and GTK for
88
scale_factor=$(wslsys -S -s)
99

1010
sudo tee "/etc/profile.d/hidpi.sh" <<EOF
11-
#!/bin/bash
12-
export QT_SCALE_FACTOR=${scale_factor}
13-
export GDK_SCALE=\$(echo "(\${QT_SCALE_FACTOR} + 0.49) / 1" | bc) #Round
14-
export GDK_DPI_SCALE=\$(echo "\${QT_SCALE_FACTOR} / \${GDK_SCALE}" | bc -l)
11+
#!/bin/sh
12+
13+
if [ -z "\${XRANDRDPI}" ] || [ "\${XRANDRDPI}" -eq 96 ]; then
14+
scale_factor=${scale_factor}
15+
export QT_SCALE_FACTOR=\${scale_factor}
16+
else
17+
scale_factor=\$(echo "\${XRANDRDPI} / 96" | bc -l)
18+
fi
19+
20+
# shellcheck disable=SC2155
21+
export GDK_SCALE=\$(echo "(\${scale_factor} + 0.49) / 1" | bc) #Round
22+
# shellcheck disable=SC2155
23+
export GDK_DPI_SCALE=\$(echo "\${scale_factor} / \${GDK_SCALE}" | bc -l)
1524
16-
if [ "\$(echo "\${QT_SCALE_FACTOR} >= 2" | bc -l)" -eq 1 ]; then
25+
if [ "\$(echo "\${scale_factor} >= 2" | bc -l)" -eq 1 ]; then
1726
export XCURSOR_SIZE=64
18-
elif [ "\$(echo "\${QT_SCALE_FACTOR} >= 1.5" | bc -l)" -eq 1 ]; then
27+
elif [ "\$(echo "\${scale_factor} >= 1.5" | bc -l)" -eq 1 ]; then
1928
export XCURSOR_SIZE=32
2029
else
2130
export XCURSOR_SIZE=16
2231
fi
2332
33+
unset scale_factor
34+
2435
EOF
2536

37+
# add_fish_support 'hidpi' # not working with bass
2638

2739
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
2840

pengwin-setup.d/lamp.sh

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,35 @@ function install_lamp() {
1212
local menu_choice=$(
1313
1414
menu --title "MariaDB" --radiolist "Choose what version of MariaDB you want to install\n[SPACE to select, ENTER to confirm]:" 14 65 5 \
15-
"10.2" "Install MariaDB 10.2 from MariaDB" off \
1615
"10.3" "Install MariaDB 10.3 from MariaDB" off \
1716
"10.4" "Install MariaDB 10.4 from MariaDB" off \
1817
"10.5" "Install MariaDB 10.5 from MariaDB" off \
18+
"10.6" "Install MariaDB 10.6 from MariaDB" off \
1919
"BUILTIN" "Install MariaDB from Debian Official Repo " off
2020
2121
# shellcheck disable=SC2188
2222
3>&1 1>&2 2>&3
2323
)
2424

25+
echo "Selected:" "${menu_choice}"
2526
echo "Installing MariaDB Database Server"
2627

27-
if [[ ${menu_choice} == "CANCELLED" ]] || [[ ${menu_choice} == "BUILTIN" ]]; then
28+
if [[ ${menu_choice} == "CANCELLED" ]]; then
29+
return 1
30+
fi
31+
32+
# shellcheck disable=SC2155
33+
local selected_version=$(echo "${menu_choice##* }" | grep -E "10\.[1-6]?")
34+
if [[ ${menu_choice} == *"BUILTIN"* ]]; then
35+
36+
if [[ -n ${NON_INTERACTIVE} ]]; then
37+
export DEBIAN_FRONTEND=noninteractive
38+
fi
39+
2840
install_packages mariadb-server mariadb-client
2941
apt policy mariadb-server
30-
else
42+
43+
elif [[ -n ${selected_version} ]]; then
3144
if curl -sSO https://downloads.mariadb.com/MariaDB/mariadb-keyring-2019.gpg; then
3245
if curl -sS https://downloads.mariadb.com/MariaDB/mariadb-keyring-2019.gpg.sha256 | sha256sum -c --quiet; then
3346
echo 'Running apt-get update...'
@@ -36,24 +49,32 @@ function install_lamp() {
3649
echo 'Done adding trusted package signing keys'
3750
else
3851
echo 'Failed to add trusted package signing keys'
39-
exit 1
52+
return 1
4053
fi
4154
else
4255
echo 'Failed to verify trusted package signing keys keyring file'
43-
exit 1
56+
return 1
4457
fi
4558
else
4659
echo 'Failed to download trusted package signing keys keyring file'
4760
fi
48-
sudo apt-get -y -q install software-properties-common
49-
sudo add-apt-repository "deb http://downloads.mariadb.com/MariaDB/mariadb-${menu_choice}/repo/debian buster main"
61+
sudo apt-get -y -q install software-properties-common libdbi-perl
62+
sudo add-apt-repository "deb http://downloads.mariadb.com/MariaDB/mariadb-${selected_version}/repo/debian buster main"
5063
sudo apt-get -q update
51-
install_packages -t buster mariadb-server mariadb-client
64+
65+
if [[ -n ${NON_INTERACTIVE} ]]; then
66+
export DEBIAN_FRONTEND=noninteractive
67+
sudo debconf-set-selections <<< "mariadb-server-${selected_version} mysql-server/root_password password PASS"
68+
sudo debconf-set-selections <<< "mariadb-server-${selected_version} mysql-server/root_password_again password PASS"
69+
fi
70+
71+
install_packages -t buster mariadb-server mariadb-client mariadb-backup
5272
apt policy mariadb-server
73+
else
74+
echo "${menu_choice##* } was not found"
75+
return 1
5376
fi
5477

55-
service mariadb status
56-
5778
echo "Installing Apache Web Server"
5879
install_packages apache2 apache2-utils
5980
sudo service apache2 start
@@ -109,6 +130,8 @@ fi
109130
110131
EOF
111132

133+
/etc/profile.d/start-lamp.sh
134+
112135
else
113136
echo "Skipping SSH Server"
114137
fi

pengwin-setup.d/nodejs.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ echo "Offering user n / nvm version manager choice"
1919
menu_choice=$(
2020
2121
menu --title "nodejs" --radiolist "Choose Node.js install method\n[SPACE to select, ENTER to confirm]:" 12 90 4 \
22-
"N" "Install with n version manager (fish shell compat. EXPERIMENTAL)" off \
22+
"NVERMAN" "Install with n version manager (fish shell compat. EXPERIMENTAL)" off \
2323
"NVM" "Install with nvm version manager (fish shell compat. EXPERIMENTAL)" off \
2424
"LATEST" "Install latest version via APT package manager" off \
2525
"LTS" "Install LTS version via APT package manager" off
@@ -73,7 +73,7 @@ EOF
7373
eval "$(cat "${NPM_WIN_PROFILE}")"
7474
fi
7575

76-
if [[ ${menu_choice} == *"N"* ]]; then
76+
if [[ ${menu_choice} == *"NVERMAN"* ]]; then
7777
echo "Ensuring we have build-essential installed"
7878
sudo apt-get -y -q install build-essential
7979

@@ -118,9 +118,11 @@ EOF
118118
# Add npm to bash completion
119119
sudo mkdir -p /etc/bash_completion.d
120120
npm completion | sudo tee /etc/bash_completion.d/npm
121+
122+
touch "${HOME}"/.should-restart
121123
elif [[ ${menu_choice} == *"NVM"* ]]; then
122124
echo "Installing nvm, Node.js version manager"
123-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
125+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
124126

125127
# Set NVM_DIR variable and load nvm
126128
NVM_PATH="$(cat ${HOME}/.bashrc | grep '^export NVM_DIR=')"
@@ -171,10 +173,12 @@ EOF
171173

172174
# Add npm to bash completion
173175
npm completion | sudo tee /etc/bash_completion.d/npm
176+
177+
touch "${HOME}"/.should-restart
174178
elif [[ ${menu_choice} == *"LATEST"* ]]; then
175179
echo "Installing latest node.js version from NodeSource repository"
176180

177-
major_vers=15
181+
major_vers=16
178182
nodesrc_url="https://deb.nodesource.com/setup_${major_vers}.x"
179183
#curl -sL "$nodesrc_url" -o repo-install.sh
180184
#sudo bash repo-install.sh

pengwin-setup.d/pythonpi.sh

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,37 @@ function install_pyenv() {
1616

1717
if [[ -f "${HOME}"/.bashrc && $(grep -c '^[^#]*\bPATH.*/.pyenv/bin' "${HOME}"/.bashrc) == 0 ]]; then
1818
echo "" >>"${HOME}"/.bashrc
19-
echo "export PATH=\"\${HOME}/.pyenv/bin:\${PATH}\"" >>"${HOME}"/.bashrc
19+
echo "export PYENV_ROOT=\"\${HOME}/.pyenv\"" >>"${HOME}"/.bashrc
20+
echo "export PATH=\"\${PYENV_ROOT}/bin:\${PATH}\"" >>"${HOME}"/.bashrc
21+
echo "eval \"\$(pyenv init --path)\"" >>"${HOME}"/.bashrc
2022
echo "eval \"\$(pyenv init -)\"" >>"${HOME}"/.bashrc
21-
echo "eval \"\$(pyenv virtualenv-init -)\"" >>"${HOME}"/.bashrc
2223
fi
2324

2425
if [[ -f "${HOME}"/.zshrc && $(grep -c '^[^#]*\bPATH.*/.pyenv/bin' "${HOME}"/.zshrc) == 0 ]]; then
2526
echo "" >>"${HOME}"/.zshrc
26-
echo "export PATH=\"${HOME}/.pyenv/bin:\$PATH\"" >>"${HOME}"/.zshrc
27+
echo "export PYENV_ROOT=\"\${HOME}/.pyenv\"" >>"${HOME}"/.zshrc
28+
echo "export PATH=\"\${PYENV_ROOT}/bin:\${PATH}\"" >>"${HOME}"/.zshrc
29+
echo "eval \"\$(pyenv init --path)\"" >>"${HOME}"/.zshrc
2730
echo "eval \"\$(pyenv init -)\"" >>"${HOME}"/.zshrc
28-
echo "eval \"\$(pyenv virtualenv-init -)\"" >>"${HOME}"/.zshrc
2931
fi
3032

3133
# shellcheck disable=SC2002
3234
if [[ -d "${HOME}"/.config/fish && $(cat "${HOME}"/.config/fish/config.fish 2>/dev/null | grep -c '^[^#]*\bPATH.*/.pyenv/bin') == 0 ]]; then
3335
echo "" >>"${HOME}"/.config/fish/config.fish
34-
echo "set -x PATH \"${HOME}/.pyenv/bin\" \$PATH" >>"${HOME}"/.config/fish/config.fish
36+
echo "set -x PYENV_ROOT \"${HOME}/.pyenv\"" >>"${HOME}"/.config/fish/config.fish
37+
echo "set -x PATH \"${PYENV_ROOT}/bin\" \$PATH" >>"${HOME}"/.config/fish/config.fish
38+
echo 'status --is-interactive; and pyenv init --path| source' >>"${HOME}"/.config/fish/config.fish
3539
echo 'status --is-interactive; and pyenv init -| source' >>"${HOME}"/.config/fish/config.fish
36-
echo 'status --is-interactive; and pyenv virtualenv-init -| source' >>"${HOME}"/.config/fish/config.fish
3740
fi
3841

39-
echo "installing Python 3.9"
40-
export PATH="${HOME}/.pyenv/bin:$PATH"
42+
echo "Installing Python 3.9"
43+
export PYENV_ROOT="$HOME/.pyenv"
44+
export PATH="$PYENV_ROOT/bin:$PATH"
45+
eval "$(pyenv init --path)"
4146
eval "$(pyenv init -)"
42-
eval "$(pyenv virtualenv-init -)"
43-
pyenv install -s 3.9.4
44-
pyenv global 3.9.4
47+
48+
pyenv install -s 3.9.6
49+
pyenv global 3.9.6
4550

4651
touch "${HOME}"/.should-restart
4752

@@ -99,6 +104,8 @@ function main() {
99104
3>&1 1>&2 2>&3
100105
)
101106

107+
echo "Selected:" "${menu_choice}"
108+
102109
if [[ ${menu_choice} == "CANCELLED" ]]; then
103110
return 1
104111
fi

pengwin-setup.d/uninstall/guilib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function main() {
1111
sudo_rem_file "/etc/dbus-1/session.conf"
1212
sudo_rem_file "/usr/share/dbus-1/session.conf"
1313
sudo_rem_file "/etc/profile.d/dbus.sh"
14+
sudo_rem_file "${__fish_sysconf_dir:=/etc/fish/conf.d}/dbus.fish"
1415

1516
remove_package xclip gnome-themes-standard gtk2-engines-murrine dbus dbus-x11 mesa-utils libqt5core5a binutils libnss3 libegl1-mesa
1617
}

pengwin-setup.d/uninstall/hidpi.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function main() {
77

88
echo "Uninstalling Qt and GTK HiDPI modifications"
99
sudo_rem_file "/etc/profile.d/hidpi.sh"
10+
sudo_rem_file "${__fish_sysconf_dir:=/etc/fish/conf.d}/hidpi.fish"
1011

1112
}
1213

0 commit comments

Comments
 (0)