Skip to content

Commit

Permalink
Merge pull request #357 from WhitewaterFoundry/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
crramirez authored Dec 7, 2021
2 parents ffe0e70 + 4f4e11d commit a9c9689
Show file tree
Hide file tree
Showing 17 changed files with 198 additions and 37 deletions.
47 changes: 42 additions & 5 deletions pengwin-setup.d/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ declare WIN_CUR_VER
#Imported global variables
declare USER

#######################################
# description
# Globals:
# GOPATH
# GOROOT
# GOVERSION
# PATH
# USER
# wHome
# Arguments:
# None
#######################################
function docker_install_build_relay() {
#Build the relay
if [[ ! -f "${wHome}/.npiperelay/npiperelay.exe" ]]; then
Expand Down Expand Up @@ -75,7 +87,7 @@ function docker_install_build_relay() {
PATH="$1"
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
connected=$(docker version 2>&1 | grep -c "daemon\|error")
if [[ ${connected} != 0 ]]; then
Expand All @@ -98,7 +110,7 @@ EOF
cat <<'EOF' >>docker_relay.sh
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
sudo docker-relay "${PATH}"
fi
EOF
Expand All @@ -117,6 +129,14 @@ EOF
sudo docker version
}

#######################################
# description
# Globals:
# DOCKER_HOST
# connected
# Arguments:
# None
#######################################
function docker_install_conf_tcp() {
echo "Connect to Docker via TCP"

Expand All @@ -141,15 +161,20 @@ EOF
fi
}

#######################################
# description
# Arguments:
# None
#######################################
function docker_install_conf_toolbox() {
echo "Connect to Docker Toolbox"

cat <<'EOF' >>docker_relay.sh
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
VM=${DOCKER_MACHINE_NAME-default}
DOCKER_MACHINE="$(which docker-machine.exe)"
DOCKER_MACHINE="$(command -v docker-machine.exe)"
eval "$("${DOCKER_MACHINE}" env --shell=bash --no-proxy "${VM}" 2>/dev/null )" > /dev/null 2>&1
if [[ "${DOCKER_CERT_PATH}" != "" ]] ; then
Expand All @@ -165,6 +190,18 @@ EOF
docker version
}

#######################################
# description
# Globals:
# DOCKER_COMPOSE_VERSION
# DOCKER_VERSION
# HOME
# WIN_CUR_VER
# Arguments:
# None
# Returns:
# <unknown> ...
#######################################
function main() {

if (confirm --title "DOCKER" --yesno "Would you like to install the bridge to Docker?" 8 55); then
Expand Down Expand Up @@ -268,7 +305,7 @@ EOF
cat <<'EOF' >>create-mnt-c-link.sh
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
sudo create-mnt-c-link
fi
Expand Down
2 changes: 1 addition & 1 deletion pengwin-setup.d/dotnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (confirm --title "DOTNET" --yesno "Would you like to download and install the

update_packages

install_packages dotnet-sdk-5.0
install_packages dotnet-sdk-6.0
cleantmp

if (confirm --title "NUGET" --yesno "Would you like to download and install NuGet?" 8 50) ; then
Expand Down
21 changes: 20 additions & 1 deletion pengwin-setup.d/explorer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ source "$(dirname "$0")/common.sh" "$@"
declare SetupDir


#######################################
# description
# Globals:
# wHome
# Arguments:
# None
#######################################
function install_explorer() {

local exec_name='pengwin.exe'
Expand Down Expand Up @@ -37,7 +44,7 @@ EOF

cp /usr/local/lib/pengwin.ico "${wHome}/Pengwin"

local fullexec=$(wslpath -m "$(which ${exec_name})" | sed 's$/$\\\\\\\\$g')
local fullexec=$(wslpath -m "$(command -v ${exec_name})" | sed 's$/$\\\\\\\\$g')
local icopath=$(cmd-exe /C "echo '%USERPROFILE%\\Pengwin\\pengwin.ico'" | tr -d '\r' | sed 's$\\$\\\\\\\\$g')
icopath=$(echo $icopath | tr -d "\'")
sed -i "s/_${plain_name}Path_/${fullexec}/g" Install.reg
Expand All @@ -62,6 +69,13 @@ EOF
fi
}

#######################################
# description
# Globals:
# SKIP_CONFIMATIONS
# Arguments:
# None
#######################################
function upgrade_explorer() {

local plain_name='WLinux'
Expand All @@ -83,6 +97,11 @@ EOF
install_explorer
}

#######################################
# description
# Arguments:
# 1
#######################################
function main() {

if [[ $# -gt 0 && "$1" == "--upgrade" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions pengwin-setup.d/guilib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if (confirm --title "GUI Libraries" --yesno "Would you like to install a base se
#!/bin/sh
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
eval "\$(timeout 2s dbus-launch --auto-syntax)"
fi
Expand All @@ -47,7 +47,7 @@ EOF
#!/bin/fish
# Check if we have Windows Path
if which cmd.exe >/dev/null
if command -q cmd.exe
for line in (timeout 2s dbus-launch | string match '*=*')
set -l kv (string split -m 1 = -- \$line )
Expand Down
4 changes: 4 additions & 0 deletions pengwin-setup.d/java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ if (confirm --title "Java" --yesno "Would you like to Install SDKMan to manage a
sudo tee "/etc/profile.d/sdkman.sh" <<EOF
#!/bin/sh
if [ -n "\${XRDP_SESSION}" ]; then
return
fi
export SDKMAN_DIR="\${HOME}/.sdkman"
if [ -s "\${HOME}/.sdkman/bin/sdkman-init.sh" ]; then
Expand Down
21 changes: 19 additions & 2 deletions pengwin-setup.d/lamp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
# shellcheck source=./common.sh
source "$(dirname "$0")/common.sh" "$@"

#######################################
# description
# Globals:
# DEBIAN_FRONTEND
# HOME
# NON_INTERACTIVE
# profile_start_lamp
# Arguments:
# None
# Returns:
# 1 ...
#######################################
function install_lamp() {

if (confirm --title "LAMP Stack" --yesno "Would you like to install the LAMP Stack?" 10 60); then
Expand Down Expand Up @@ -113,10 +125,10 @@ EOF

profile_start_lamp="/etc/profile.d/start-lamp.sh"
sudo tee "${profile_start_lamp}" <<EOF
#!/bin/bash
#!/bin/sh
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
sudo ${start_lamp}
Expand All @@ -134,6 +146,11 @@ EOF

}

#######################################
# description
# Arguments:
# None
#######################################
function main() {

install_lamp
Expand Down
13 changes: 7 additions & 6 deletions pengwin-setup.d/nodejs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,29 @@ echo "Look for Windows version of npm"
NPM_WIN_PROFILE="/etc/profile.d/rm-win-npm-path.sh"
NPM_PROFILE="/etc/profile.d/n-prefix.sh"

if [[ "$(which npm)" == $(wslpath 'C:\')* ]]; then
if [[ "$(command -v npm)" == $(wslpath 'C:\')* ]]; then

if ! (confirm --title "npm in Windows" --yesno "npm is already installed in Windows in \"$(wslpath -m "$(which npm)")\".\n\nWould you still want to install the Linux version? This will hide the Windows version inside Pengwin." 12 80); then
if ! (confirm --title "npm in Windows" --yesno "npm is already installed in Windows in \"$(wslpath -m "$(command -v npm)")\".\n\nWould you still want to install the Linux version? This will hide the Windows version inside Pengwin." 12 80); then
echo "Skipping NODE"
exit 1
fi

sudo tee "${NPM_WIN_PROFILE}" <<EOF
#!/bin/bash
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
WIN_C_PATH="\$(wslpath 'C:\')"
while [[ true ]]; do
WIN_YARN_PATH="\$(dirname "\$(which yarn)")"
WIN_YARN_PATH="\$(dirname "\$(command -v yarn)")"
if [[ "\${WIN_YARN_PATH}" == "\${WIN_C_PATH}"* ]]; then
export PATH=\$(echo "\${PATH}" | sed -e "s#\${WIN_YARN_PATH}##")
fi
WIN_NPM_PATH="\$(dirname "\$(which npm)")"
WIN_NPM_PATH="\$(dirname "\$(command -v npm)")"
if [[ "\${WIN_NPM_PATH}" == "\${WIN_C_PATH}"* ]]; then
export PATH=\$(echo "\${PATH}" | sed -e "s#\${WIN_NPM_PATH}##")
else
Expand All @@ -79,7 +80,7 @@ if [[ ${menu_choice} == *"NVERMAN"* ]]; then

echo "Installing n, Node.js version manager"
curl -L https://git.io/n-install -o n-install.sh
env SHELL="$(which bash)" bash n-install.sh -y #Force the installation to bash
env SHELL="$(command -v bash)" bash n-install.sh -y #Force the installation to bash

N_PATH="$(cat ${HOME}/.bashrc | grep "^.*N_PREFIX.*$" | cut -d'#' -f 1)"
echo "${N_PATH}" | sudo tee "${NPM_PROFILE}"
Expand Down
12 changes: 6 additions & 6 deletions pengwin-setup.d/pythonpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source "$(dirname "$0")/common.sh" "$@"

function install_pyenv() {

if (confirm --title "PYTHON" --yesno "Would you like to download and install Python 3.9 with pyenv?" 8 70); then
if (confirm --title "PYTHON" --yesno "Would you like to download and install Python 3.10 with pyenv?" 8 70); then
echo "Installing PYENV"
createtmp
install_packages make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
Expand Down Expand Up @@ -39,14 +39,14 @@ function install_pyenv() {
echo 'status --is-interactive; and pyenv init -| source' >>"${HOME}"/.config/fish/config.fish
fi

echo "Installing Python 3.9"
echo "Installing Python 3.10"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"

pyenv install -s 3.9.7
pyenv global 3.9.7
pyenv install -s 3.10.1
pyenv global 3.10.1

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

Expand All @@ -62,7 +62,7 @@ function install_pythonpip() {
echo "Installing PYTHONPIP"
createtmp
install_packages build-essential python3.9 python3.9-distutils idle-python3.9 python3-pip python3-venv
pip3 install -U pip
pip3 install -U pip --no-warn-script-location

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

Expand Down Expand Up @@ -96,7 +96,7 @@ function main() {
local menu_choice=$(
menu --title "Python" --radiolist --separate-output "Python install options\n[SPACE to select, ENTER to confirm]:" 12 75 3 \
"PYENV" 'Python 3.9 with pyenv ' off \
"PYENV" 'Python 3.10 with pyenv ' off \
"PYTHONPIP" 'Python 3.9, IDLE, and the pip package manager ' off \
"POETRY" 'Python 3.9, IDLE, and the poetry package manager ' off
Expand Down
35 changes: 31 additions & 4 deletions pengwin-setup.d/services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ source "$(dirname "$0")/common.sh" "$@"

declare SetupDir

#######################################
# description
# Arguments:
# None
# Returns:
# 1 ...
#######################################
function enable_rclocal() {

if (confirm --title "rc.local" --yesno "Would you like to enable rc.local support for running scripts at Pengwin launch?" 10 60) ; then
Expand All @@ -29,10 +36,10 @@ EOF

local profile_rclocal="/etc/profile.d/rclocal.sh"
sudo tee "${profile_rclocal}" << EOF
#!/bin/bash
#!/bin/sh
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
sudo ${cmd}
fi
Expand All @@ -48,6 +55,16 @@ EOF

}

#######################################
# description
# Globals:
# NON_INTERACTIVE
# sshd_status
# Arguments:
# None
# Returns:
# 1 ...
#######################################
function enable_ssh() {

if (confirm --title "SSH Server" --yesno "Would you like to enable SSH Server?" 10 60) ; then
Expand Down Expand Up @@ -117,10 +134,10 @@ EOF

local profile_startssh="/etc/profile.d/start-ssh.sh"
sudo tee "${profile_startssh}" << EOF
#!/bin/bash
#!/bin/sh
# Check if we have Windows Path
if ( which cmd.exe >/dev/null ); then
if ( command -v cmd.exe >/dev/null ); then
sudo ${startSsh}
fi
Expand All @@ -133,6 +150,16 @@ EOF

}

#######################################
# description
# Globals:
# SetupDir
# Arguments:
# None
# Returns:
# 1 ...
# <unknown> ...
#######################################
function main() {

if [[ "$1" == "--enable-ssh" ]] ; then
Expand Down
Loading

0 comments on commit a9c9689

Please sign in to comment.