-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve service init script and logs - Fixed init service script to allow proper 'start' and 'stop' actions consistently. I kept struggling that service start only worked after killing the distro because sometimes it didn't start/stop properly leaving processes running and without pid file - Added service 'status' action - Added additional service debug by setting environment variable DEBUG, ie: wsl.exe -d wsl-vpnkit DEBUG=1 service wsl-vpnkit stop - Changed order in startup welcome screen having stop followed by start, this makes it easier for users to just copy/paste from welcome screen to have service running - Added log check command to see only the latest service execution logs * Added service restart - Added to README how to do start with status firt and how to enable DEBUG - Run tests twice with and without DEBUG enabled * Split build and test scripts * Fix service script without alpine start-stop-daemon * Fix service script without alpine start-stop-daemon * Service script with error checks * Fixed wsl-vpnkit.service - stop and restart actions are performed consistently Improved build.sh - able to build inside vpn if using http_proxy * Minor tweaks * Split import into dedicated script Allow build with podman Improve automated test timings * Avoid status deleting pid file by mistake * Add comment about wsl-gvproxy compilation Co-authored-by: Jose Sa <[email protected]>
- Loading branch information
Showing
7 changed files
with
76 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
wsl-vpnkit.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
#! /bin/sh -xe | ||
#!/bin/bash -xe | ||
|
||
# run from repo root | ||
# ./build.sh | ||
|
||
USERPROFILE="$(powershell.exe -c 'Write-Host -NoNewline $env:USERPROFILE')" | ||
DUMP=wsl-vpnkit.tar.gz | ||
TAG_NAME=wslvpnkit | ||
: "${DOCKER:=docker}" # docker/podman command (default: docker) | ||
DUMP=wsl-vpnkit.tar.gz # exported rootfs file | ||
TAG_NAME=wslvpnkit # build tag | ||
|
||
# build | ||
docker build -t $TAG_NAME -f ./distro/Dockerfile . | ||
CONTAINER_ID=$(docker create $TAG_NAME) | ||
docker export $CONTAINER_ID | gzip > $DUMP | ||
docker container rm $CONTAINER_ID | ||
ls -la $DUMP | ||
|
||
# reinstall | ||
wsl.exe --unregister wsl-vpnkit || : | ||
wsl.exe --import wsl-vpnkit --version 2 "$USERPROFILE\\wsl-vpnkit" $DUMP | ||
rm $DUMP | ||
build_args=() | ||
[ -z "${http_proxy}" ] || build_args+=( --build-arg http_proxy="${http_proxy}" ) | ||
[ -z "${https_proxy}" ] || build_args+=( --build-arg https_proxy="${https_proxy}" ) | ||
[ -z "${no_proxy}" ] || build_args+=( --build-arg no_proxy="${no_proxy}" ) | ||
${DOCKER} build --network host "${build_args[@]}" --tag ${TAG_NAME} --file ./distro/Dockerfile . | ||
CONTAINER_ID=$(${DOCKER} create ${TAG_NAME}) | ||
${DOCKER} export "${CONTAINER_ID}" | gzip > ${DUMP} | ||
${DOCKER} container rm "${CONTAINER_ID}" | ||
ls -la ${DUMP} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
FROM golang:1.18.8-alpine3.16 as build | ||
FROM docker.io/library/golang:1.18.8-alpine3.16 as build | ||
WORKDIR /app | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY cmd ./cmd | ||
COPY pkg ./pkg | ||
# wsl-gvproxy.exe is compiled as a windows GUI to support backgrounding | ||
RUN GOOS=windows go build -ldflags '-H=windowsgui' -o bin/wsl-gvproxy.exe ./cmd/gvproxy && \ | ||
GOOS=linux CGO_ENABLED=0 go build -ldflags '-s -w' -o bin/wsl-vm ./cmd/vm && \ | ||
find ./bin -type f -exec sha256sum {} \; | ||
|
||
FROM golang:1.18.8-alpine3.16 as licenses | ||
FROM docker.io/library/golang:1.18.8-alpine3.16 as licenses | ||
RUN apk add --no-cache git && \ | ||
apk list --installed && \ | ||
go install github.com/google/[email protected] | ||
|
@@ -19,7 +20,7 @@ COPY pkg ./pkg | |
RUN go-licenses save ./cmd/gvproxy --save_path ./licenses/gvproxy && \ | ||
go-licenses save ./cmd/vm --save_path ./licenses/vm | ||
|
||
FROM alpine:3.16.3 | ||
FROM docker.io/library/alpine:3.16.3 | ||
RUN apk add --no-cache openrc iptables && \ | ||
apk list --installed | ||
ARG REF=https://example.com/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash -xe | ||
|
||
# run from repo root | ||
# ./import.sh | ||
|
||
USERPROFILE=$(wslvar USERPROFILE) | ||
DUMP=wsl-vpnkit.tar.gz | ||
|
||
# build if necessary | ||
[ -f ${DUMP} ] || ./build.sh | ||
|
||
# reinstall | ||
wsl.exe --unregister wsl-vpnkit || : | ||
wsl.exe --import wsl-vpnkit --version 2 "${USERPROFILE}\\wsl-vpnkit" ${DUMP} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters