script to update tor-fetch script to latest published tor expert bundle; compress mac .dmg
continuous-integration/drone/pr Build is pending Details
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Dan Ballard 2023-11-18 09:18:46 -08:00
parent 570b3670f0
commit acf3fcb648
11 changed files with 50 additions and 36 deletions

View File

@ -220,7 +220,7 @@ steps:
- copy 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.36.32532\x64\Microsoft.VC143.CRT\msvcp140.dll' $Env:releasedir - copy 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.36.32532\x64\Microsoft.VC143.CRT\msvcp140.dll' $Env:releasedir
- copy README.md $Env:releasedir\ - copy README.md $Env:releasedir\
- copy windows\*.bat $Env:releasedir\ - copy windows\*.bat $Env:releasedir\
- powershell -command "Expand-Archive -Path tor.zip -DestinationPath $Env:releasedir\Tor" - Copy-Item -Path windows/tor -Destination $Env:releasedir" -recurse
- name: package-windows - name: package-windows
image: openpriv/nsis image: openpriv/nsis

2
.gitignore vendored
View File

@ -69,7 +69,9 @@ analysis_options.yaml
integration_test/env/default/tor integration_test/env/default/tor
integration_test/env/temp* integration_test/env/temp*
linux/Tor linux/Tor
linux/tor
linux/tor.tar.gz linux/tor.tar.gz
macos/tor
coverage coverage
test/failures test/failures

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd macos cd macos
curl https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-macos-0.4.7.8.tar.gz --output tor.tar.gz curl https://archive.torproject.org/tor-package-archive/torbrowser/13.0.1/tor-expert-bundle-macos-aarch64-13.0.1.tar.gz --output tor.tar.gz
tar -xzf tor.tar.gz tar -xzf tor.tar.gz
chmod a+x Tor/tor.real chmod a+x tor/tor
cd .. cd ..

View File

@ -1,6 +1,8 @@
Invoke-WebRequest -Uri https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-win64-0.4.7.8.zip -OutFile tor.zip Invoke-WebRequest -Uri https://archive.torproject.org/tor-package-archive/torbrowser/13.0.1/tor-expert-bundle-windows-x86_64-13.0.1.tar.gz -OutFile tor.tar.gz
if ((Get-FileHash tor.zip -Algorithm sha512).Hash -ne '5b8f900a37f6e90d7a945b3903d769383c7478042cb43b2105d2374186e1a536f1a4758a2823d1d5be71d53a81dcfd8243293e04f82812d355983df322823cf4' ) { Write-Error 'tor.zip sha512sum mismatch' } # if ((Get-FileHash tor.tar.gz -Algorithm sha512).Hash -ne '5b8f900a37f6e90d7a945b3903d769383c7478042cb43b2105d2374186e1a536f1a4758a2823d1d5be71d53a81dcfd8243293e04f82812d355983df322823cf4' ) { Write-Error 'tor.zip sha512sum mismatch' }
Expand-Archive -Path tor.zip -DestinationPath Tor #Expand-Archive -Path tor.tar.gz -DestinationPath tor
mkdir windows/tor
tar -xzf tor.tar.gz -C windows/tor

View File

@ -1,14 +1,22 @@
#!/bin/sh #!/bin/sh
cd linux cd linux
wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-0.4.7.8-linux-x86_64.tar.gz -O tor.tar.gz wget https://archive.torproject.org/tor-package-archive/torbrowser/13.0.1/tor-expert-bundle-linux-x86_64-13.0.1.tar.gz -O tor.tar.gz
tar -xzf tor.tar.gz tar -xzf tor.tar.gz
cd .. cd ..
mkdir -p android/app/src/main/jniLibs/arm64-v8a mkdir -p android/app/src/main/jniLibs/arm64-v8a
wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-0.4.7.10-arm64 -O android/app/src/main/jniLibs/arm64-v8a/libtor.so wget https://archive.torproject.org/tor-package-archive/torbrowser/13.0.3/tor-expert-bundle-android-aarch64-13.0.3.tar.gz -O tor-aarch64.tar.gz
mkdir tor-aarch64
tar -xzf tor-aarch64.tar.gz -C tor-aarch64
cp tor-aarch64/tor/libTor.so android/app/src/main/jniLibs/arm64-v8a/libtor.so
chmod a+x android/app/src/main/jniLibs/arm64-v8a/libtor.so chmod a+x android/app/src/main/jniLibs/arm64-v8a/libtor.so
rm -r tor-aarch64
mkdir -p android/app/src/main/jniLibs/armeabi-v7a mkdir -p android/app/src/main/jniLibs/armeabi-v7a
wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-0.4.7.10-arm7 -O android/app/src/main/jniLibs/armeabi-v7a/libtor.so wget https://archive.torproject.org/tor-package-archive/torbrowser/13.0.3/tor-expert-bundle-android-armv7-13.0.3.tar.gz -O tor-armv7.tar.gz
mkdir tor-armv7
tar -xzf tor-armv7.tar.gz -C tor-armv7
cp tor-armv7/tor/libTor.so android/app/src/main/jniLibs/armeabi-v7a/libtor.so
chmod a+x android/app/src/main/jniLibs/armeabi-v7a/libtor.so chmod a+x android/app/src/main/jniLibs/armeabi-v7a/libtor.so
rm -r tor-armv7

View File

@ -177,44 +177,44 @@ class CwtchFfi implements Cwtch {
cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, ".cwtch"); cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, ".cwtch");
} }
if (await File("linux/Tor/tor").exists()) { if (await File("linux/tor/tor").exists()) {
bundledTor = "linux/Tor/tor"; bundledTor = "linux/tor/tor";
} else if (await File("lib/Tor/tor").exists()) { } else if (await File("lib/tor/tor").exists()) {
bundledTor = "lib/Tor/tor"; bundledTor = "lib/tor/tor";
} else if (await File(path.join(home, ".local/lib/cwtch/Tor/tor")).exists()) { } else if (await File(path.join(home, ".local/lib/cwtch/tor/tor")).exists()) {
bundledTor = path.join(home, ".local/lib/cwtch/Tor/tor"); bundledTor = path.join(home, ".local/lib/cwtch/tor/tor");
} else if (await File("/usr/lib/cwtch/Tor/tor").exists()) { } else if (await File("/usr/lib/cwtch/tor/tor").exists()) {
bundledTor = "/usr/lib/cwtch/Tor/tor"; bundledTor = "/usr/lib/cwtch/tor/tor";
} else { } else {
bundledTor = "tor"; bundledTor = "tor";
} }
} else if (Platform.isWindows) { } else if (Platform.isWindows) {
cwtchDir = envVars['CWTCH_DIR'] ?? path.join(envVars['UserProfile']!, ".cwtch"); cwtchDir = envVars['CWTCH_DIR'] ?? path.join(envVars['UserProfile']!, ".cwtch");
String currentTor = path.join(Directory.current.absolute.path, "Tor\\Tor\\tor.exe"); String currentTor = path.join(Directory.current.absolute.path, "tor\\tor\\tor.exe");
if (await File(currentTor).exists()) { if (await File(currentTor).exists()) {
bundledTor = currentTor; bundledTor = currentTor;
} else { } else {
String exeDir = path.dirname(Platform.resolvedExecutable); String exeDir = path.dirname(Platform.resolvedExecutable);
bundledTor = path.join(exeDir, "Tor\\Tor\\tor.exe"); bundledTor = path.join(exeDir, "tor\\tor\\tor.exe");
} }
} else if (Platform.isMacOS) { } else if (Platform.isMacOS) {
cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, "Library/Application Support/Cwtch"); cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, "Library/Application Support/Cwtch");
if (await File("Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { if (await File("Cwtch.app/Contents/MacOS/tor/tor").exists()) {
bundledTor = "Cwtch.app/Contents/MacOS/Tor/tor.real"; bundledTor = "Cwtch.app/Contents/MacOS/tor/tor";
} else if (await File("/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { } else if (await File("/Applications/Cwtch.app/Contents/MacOS/tor/tor").exists()) {
bundledTor = "/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real"; bundledTor = "/Applications/Cwtch.app/Contents/MacOS/tor/tor";
} else if (await File("/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { } else if (await File("/Volumes/Cwtch/Cwtch.app/Contents/MacOS/tor/tor").exists()) {
bundledTor = "/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real"; bundledTor = "/Volumes/Cwtch/Cwtch.app/Contents/MacOS/tor/tor";
} else if (await File("/Applications/Tor Browser.app/Contents/MacOS/Tor/tor.real").exists()) { } else if (await File("/Applications/Tor Browser.app/Contents/MacOS/tor/tor").exists()) {
bundledTor = "/Applications/Tor Browser.app/Contents/MacOS/Tor/tor.real"; bundledTor = "/Applications/Tor Browser.app/Contents/MacOS/tor/tor";
print("We couldn't find Tor in the Cwtch app directory, however we can fall back to the Tor Browser binary"); print("We couldn't find Tor in the Cwtch app directory, however we can fall back to the Tor Browser binary");
} else { } else {
var splitPath = path.split(dirname(Platform.script.path)); var splitPath = path.split(dirname(Platform.script.path));
if (splitPath[0] == "/" && splitPath[1] == "Applications") { if (splitPath[0] == "/" && splitPath[1] == "Applications") {
var appName = splitPath[2]; var appName = splitPath[2];
print("We're running in /Applications in a non standard app name: $appName"); print("We're running in /Applications in a non standard app name: $appName");
if (await File("/Applications/$appName/Contents/MacOS/Tor/tor.real").exists()) { if (await File("/Applications/$appName/Contents/MacOS/tor/tor").exists()) {
bundledTor = "/Applications/$appName/Contents/MacOS/Tor/tor.real"; bundledTor = "/Applications/$appName/Contents/MacOS/tor/tor";
} }
} }
} }

View File

@ -2,4 +2,4 @@
# Script to run cwtch directly from package tarball directory # Script to run cwtch directly from package tarball directory
exec env LD_LIBRARY_PATH=./lib/:./lib/Tor ./lib/cwtch exec env LD_LIBRARY_PATH=./lib/:./lib/tor ./lib/cwtch

View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
exec env LD_LIBRARY_PATH=PREFIX/lib/cwtch/:PREFIX/lib/cwtch/Tor PREFIX/lib/cwtch/cwtch exec env LD_LIBRARY_PATH=PREFIX/lib/cwtch/:PREFIX/lib/cwtch/tor PREFIX/lib/cwtch/cwtch

View File

@ -9,4 +9,4 @@ cp linux/cwtch build/linux/x64/release/bundle/
cp README.md build/linux/x64/release/bundle/ cp README.md build/linux/x64/release/bundle/
cp linux/cwtch.png build/linux/x64/release/bundle/ cp linux/cwtch.png build/linux/x64/release/bundle/
cp linux/libCwtch.so build/linux/x64/release/bundle/lib/ cp linux/libCwtch.so build/linux/x64/release/bundle/lib/
cp -r linux/Tor build/linux/x64/release/bundle/lib cp -r linux/tor build/linux/x64/release/bundle/lib

View File

@ -4,7 +4,7 @@
cp libCwtch.x64.dylib build/macos/Build/Products/Release/Cwtch.app/Contents/Frameworks/ cp libCwtch.x64.dylib build/macos/Build/Products/Release/Cwtch.app/Contents/Frameworks/
cp libCwtch.arm64.dylib build/macos/Build/Products/Release/Cwtch.app/Contents/Frameworks/ cp libCwtch.arm64.dylib build/macos/Build/Products/Release/Cwtch.app/Contents/Frameworks/
cp -r macos/Tor build/macos/Build/Products/Release/Cwtch.app/Contents/MacOS/ cp -r macos/tor build/macos/Build/Products/Release/Cwtch.app/Contents/MacOS/
@ -16,7 +16,9 @@ cp -r "build/macos/Build/Products/Release/Cwtch.app" macos_dmg/
cp macos/dmg/.DS_Store macos_dmg/ cp macos/dmg/.DS_Store macos_dmg/
cp macos/dmg/.VolumeIcon.icns macos_dmg/ cp macos/dmg/.VolumeIcon.icns macos_dmg/
ln -s /Applications macos_dmg/Applications ln -s /Applications macos_dmg/Applications
hdiutil create -fs HFS+ -volname Cwtch -srcfolder macos_dmg Cwtch.dmg hdiutil create -fs HFS+ -volname Cwtch -srcfolder macos_dmg Cwtch.tmp.dmg
# compress
hdiutil convert Cwtch.tmp.dmg -format UDZO -imagekey zlib-level=9 -o Cwtch.dmg
# create-dmg requires GUI and is therefore less suited to automated builds, preserving here for # create-dmg requires GUI and is therefore less suited to automated builds, preserving here for
# manual runs to generate new .DS_Store and .VolumeIcon.icns for capture to the dmg dir for automated reuse # manual runs to generate new .DS_Store and .VolumeIcon.icns for capture to the dmg dir for automated reuse

View File

@ -5,8 +5,8 @@ sed "s|featurePaths: REPLACED_BY_SCRIPT|featurePaths: <String>[$paths]|" integra
flutter pub run build_runner clean flutter pub run build_runner clean
flutter pub run build_runner build --delete-conflicting-outputs flutter pub run build_runner build --delete-conflicting-outputs
PATH=$PATH:$PWD/linux/Tor PATH=$PATH:$PWD/linux/tor
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$PWD/linux/":"$PWD/linux/Tor/" LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$PWD/linux/":"$PWD/linux/tor/"
PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH LOG_FILE=test.log CWTCH_HOME=$PWD/integration_test/env/temp/ flutter test -d linux --dart-define TEST_MODE=true integration_test/gherkin_suite_test.dart PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH LOG_FILE=test.log CWTCH_HOME=$PWD/integration_test/env/temp/ flutter test -d linux --dart-define TEST_MODE=true integration_test/gherkin_suite_test.dart
#node index2.js #node index2.js
#if [ "$HEADLESS" = "false" ]; then #if [ "$HEADLESS" = "false" ]; then