...
 
Commits (3)
......@@ -59,12 +59,12 @@ jobs:
BOUNDERY_APP_TEST: 1
BOUNDERY_ENUM_FIXED: 1
run: |
choco install -y zerotier-one
Start-Process msiexec.exe -Wait -ArgumentList '/I "boundery-client-windows.msi" /qn'
refreshenv
echo XXX $env:PATH
cd "C:\Program Files (x86)\Boundery Client"
& "C:\Program Files (x86)\Boundery Client\python\python.exe" app\start.py
#XXX Just install for now, UAC doesn't seem to work on github's windows, and
# no USB/SDCard storage is available.
#& "C:\Program Files (x86)\Boundery Client\python\python.exe" app\start.py
- name: Build installer (MacOS)
if: runner.os == 'macOS'
......
CLIENT_VER=0.0.1
export VAGRANT_DEFAULT_PROVIDER=libvirt
#export VAGRANT_DEFAULT_PROVIDER=libvirt
DOCKER=docker
VAGRANT=vagrant
......@@ -25,8 +25,8 @@ linux:
dd if=/dev/zero of=$@ bs=1024 count=10k
printf 'n\np\n1\n\n\nt\nc\nw\n' | fdisk $@
mformat -i$@@@1M -s32 -h64 -t9 -v"BNDRY TEST"
#.vagrant/vfat-windows.vdi: .vagrant/vfat.img
# VBoxManage convertfromraw $< $@ --format vdi --uuid 00000000-4455-6677-8899-aabbccddeeff
.vagrant/vfat-windows.vdi: .vagrant/vfat.img
VBoxManage convertfromraw $< $@ --format vdi --uuid 00000000-4455-6677-8899-aabbccddeeff
.vagrant/vfat-macos.vdi: .vagrant/vfat.img
VBoxManage convertfromraw $< $@ --format vdi --uuid 11111111-4455-6677-8899-aabbccddeeff
......@@ -40,7 +40,7 @@ windows:
$(VAGRANT) ssh windows --no-tty -c 'tar cf - -C /c/vagrant windows' | tar xmf -
$(VAGRANT) halt windows
.PHONY: windows-test
windows-test: windows/Boundery\ Client-$(CLIENT_VER).msi
windows-test: windows/Boundery\ Client-$(CLIENT_VER).msi .vagrant/vfat-windows.vdi
$(VAGRANT) up windows
$(VAGRANT) provision --provision-with test windows
$(VAGRANT) ssh windows --no-tty -c "[ -f /c/vagrant/windows/tests_passed ]"
......
......@@ -6,13 +6,13 @@ def add_usb_vdi(vb, machine)
if not File.exist?(vdi)
return
end
# id = File.read(".vagrant/machines/#{machine}/virtualbox/id")
# if `VBoxManage showvminfo #{id} --machinereadable | egrep '^storagecontrollername[0-9]+="BOUNDERYUSB"$'`.length <= 0
# vb.customize ['storagectl', id, '--name', 'BOUNDERYUSB', '--add', 'usb', '--controller', 'USB']
# end
# vb.customize ['storageattach', id, '--storagectl', 'BOUNDERYUSB',
# '--port', 1, '--device', 0, '--type', 'hdd',
# '--medium', vdi, '--hotpluggable', 'on', '--nonrotational', 'on']
id = File.read(".vagrant/machines/#{machine}/virtualbox/id")
if `VBoxManage showvminfo #{id} --machinereadable | egrep '^storagecontrollername[0-9]+="BOUNDERYUSB"$'`.length <= 0
vb.customize ['storagectl', id, '--name', 'BOUNDERYUSB', '--add', 'usb', '--controller', 'USB']
end
vb.customize ['storageattach', id, '--storagectl', 'BOUNDERYUSB',
'--port', 1, '--device', 0, '--type', 'hdd',
'--medium', vdi, '--hotpluggable', 'on', '--nonrotational', 'on']
end
Vagrant.configure("2") do |config|
......@@ -25,8 +25,8 @@ Vagrant.configure("2") do |config|
#vb.gui = true
vb.memory = "2048"
#vb.customize ['modifyvm', :id, '--usb', 'on']
#add_usb_vdi(vb, 'windows')
vb.customize ['modifyvm', :id, '--usb', 'on']
add_usb_vdi(vb, 'windows')
end
win.vm.provider "libvirt" do |libvirt|
libvirt.memory = "2048"
......@@ -101,12 +101,12 @@ Vagrant.configure("2") do |config|
#XXX error out if \\vagrant\windows\*.msi doesn't exist.
rm -Fo -ErrorAction SilentlyContinue \\vagrant\\windows\\tests_passed
echo " ****** Formatting target disk ******"
Get-Disk |
Where partitionstyle -eq 'raw' |
Initialize-Disk -PartitionStyle MBR -PassThru |
New-Partition -DriveLetter D -UseMaximumSize
Format-Volume D -FileSystem FAT32 -NewFileSystemLabel "BNDRY TEST" -Force -Confirm:$false
#echo " ****** Formatting target disk ******"
#Get-Disk |
#Where partitionstyle -eq 'raw' |
#Initialize-Disk -PartitionStyle MBR -PassThru |
#New-Partition -DriveLetter D -UseMaximumSize
#Format-Volume D -FileSystem FAT32 -NewFileSystemLabel "BNDRY TEST" -Force -Confirm:$false
echo " ****** Installing ZeroTier ******"
choco install -y zerotier-one
......@@ -176,8 +176,15 @@ Vagrant.configure("2") do |config|
-configure -allowAccessFor -allUsers \
-configure -restart -agent -privs -all
echo " ****** Enabling Autologin ******"
#XXX May not be needed thanks to BOUNDERY_VAGRANT_PW=1
#https://github.com/timsutton/osx-vm-templates/blob/master/scripts/autologin.sh
echo -e -n '\x0b\xe8\x35\x51\xb3\xd2\xa9\xea\xc4\x7f\x76\x0e' | sudo tee /etc/kcpassword > /dev/null
sudo chmod 0600 /etc/kcpassword
sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser vagrant
echo " ****** Installing git ******"
curl -# -L -o /tmp/git.dmg https://sourceforge.net/projects/git-osx-installer/files/git-2.22.0-intel-universal-mavericks.dmg/download?use_mirror=autoselect
curl -# -L -o /tmp/git.dmg "https://sourceforge.net/projects/git-osx-installer/files/git-2.22.0-intel-universal-mavericks.dmg/download?use_mirror=autoselect"
VOL=`sudo hdiutil attach /tmp/git.dmg | grep /Volumes/ | cut -f3`
sudo installer -pkg "$VOL"/git-*.pkg -target /
sudo hdiutil detach "$VOL"
......@@ -188,6 +195,17 @@ Vagrant.configure("2") do |config|
sudo installer -pkg /tmp/python3.pkg -target /
rm /tmp/python3.pkg
echo " ****** Installing Xcode command line tools ******"
#https://apple.stackexchange.com/questions/107307/how-can-i-install-the-command-line-tools-completely-from-the-command-line
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
PROD=$(softwareupdate -l |
grep "\*.*Command Line" |
head -n 1 | awk -F"*" '{print $2}' |
sed -e 's/^ *//' |
tr -d '\n')
softwareupdate -i "$PROD" --verbose
rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
echo " ****** Setting up python venv ******"
python3 -m venv venv
. venv/bin/activate
......@@ -195,6 +213,8 @@ Vagrant.configure("2") do |config|
echo " ****** Installing briefcase ******"
pip install briefcase
#XXX Bug in briefcase 0.2.10 https://github.com/beeware/briefcase/issues/295
sed -i '' 's/xcodebuild/true/1' /Users/vagrant/venv/lib/python3.7/site-packages/briefcase/macos.py
echo " ****** Prep done ******"
SHELL
......@@ -219,7 +239,7 @@ Vagrant.configure("2") do |config|
mac.vm.provision "test", type: "shell", run: "never", privileged: false, inline: <<-SHELL
set -e
rm /vagrant/macOS/tests_passed
rm -f /vagrant/macOS/tests_passed
echo " ****** Installing ZeroTier ******"
if [ -z "`which zerotier-cli`" ]; then
......@@ -236,8 +256,7 @@ Vagrant.configure("2") do |config|
echo " ****** Run tests *******"
diskutil mount "BNDRY TEST" #No one is logged in, so we have to manually mount.
#XXX sudo here? WTF?
sudo BOUNDERY_APP_TEST=1 "$VOL/Boundery Client.app/Contents/MacOS/Boundery Client"
BOUNDERY_APP_TEST=1 BOUNDERY_USE_VAGRANT_PW=1 "$VOL/Boundery Client.app/Contents/MacOS/Boundery Client"
sudo hdiutil detach "$VOL" -force
touch /vagrant/macOS/tests_passed
......
......@@ -3,10 +3,16 @@ import os, sys
if os.name == "posix":
if sys.platform.startswith("darwin"):
from .osal_macos import *
sudo_test = ['cat', '/etc/sudoers']
sudo_expected = '#'
else:
from .osal_linux import *
sudo_test = ['cat', '/etc/gshadow']
sudo_expected = 'root:'
else:
from .osal_windows import *
sudo_test = ['net', 'session']
sudo_expected = 'There are no entries in the list.'
def self_test():
import logging
......@@ -14,18 +20,14 @@ def self_test():
try:
print("Testing get_mounts")
mounts = get_mounts()
#XXX Reenable this when we can make github actions fake a FAT drive.
print("XXX", mounts)
#if len(mounts) != 1 or mounts[0][0] != 'BNDRY TEST':
# logging.error("get_mounts failed: '%s'" % mounts)
# return 10
if len(mounts) != 1 or mounts[0][0] != 'BNDRY TEST':
logging.error("get_mounts failed: '%s'" % mounts)
return 10
#XXX https://superuser.com/questions/667607/check-if-current-command-prompt-was-launched-as-the-administrator
print("Testing sudo")
sudoproc = sudo('net session')
#XXX Check return code?
sudoproc = sudo(*sudo_test)
sudo_out = sudoproc.stdout.read()
if not sudo_out.startswith('200 info '):
if not sudo_out.startswith(sudo_expected):
logging.error("sudo failed: '%s' '%s'" % (sudo_out, sudoproc.stderr.read()))
return 20
......
......@@ -39,6 +39,8 @@ def sudo(cmd, *args):
#XXX Hack: we replace ' ' with '?' because I couldn't get osascript quoting right.
osascript = r"""do shell script "%s" with prompt "Create private networks" with administrator privileges""" % scriptname.replace(' ', '?')
if os.environ.get('BOUNDERY_USE_VAGRANT_PW', '') == '1':
osascript += ' user name "vagrant" password "vagrant"'
topriv = os.path.join(boundery_dir, "topriv")
frompriv = os.path.join(boundery_dir, "frompriv")
......