diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..5320d2b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,403 @@ +name: BuildServerPackages +on: workflow_dispatch + +jobs: + BuildBusterArm64: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArm64 + run: | + ./containerBuilders/createBuildImage.sh buster arm64 go1.20.4.linux-arm64.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh buster arm64 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: BusterServerPackageArm64 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestBusterArm64: + needs: BuildBusterArm64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: BusterServerPackageArm64 + path: out + + - name: TestingPackageArm64 + run: | + ./containerBuilders/createTestingImage.sh buster arm64 + ./testScripts/startServerPackageTest.sh buster arm64 + + BuildBusterArmv7: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArmv7 + run: | + ./containerBuilders/createBuildImage.sh buster arm/v7 go1.20.4.linux-armv6l.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh buster arm/v7 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: BusterServerPackageArmv7 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestBusterArmv7: + needs: BuildBusterArmv7 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: BusterServerPackageArmv7 + path: out + + - name: TestingPackageArmv7 + run: | + ./containerBuilders/createTestingImage.sh buster arm/v7 + ./testScripts/startServerPackageTest.sh buster arm/v7 + + BuildBullseyeArm64: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArm64 + run: | + ./containerBuilders/createBuildImage.sh bullseye arm64 go1.20.4.linux-arm64.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh bullseye arm64 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: BullseyeServerPackageArm64 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestBullseyeArm64: + needs: BuildBullseyeArm64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: BullseyeServerPackageArm64 + path: out + + - name: TestingPackageArm64 + run: | + ./containerBuilders/createTestingImage.sh bullseye arm64 + ./testScripts/startServerPackageTest.sh bullseye arm64 + + BuildBullseyeArmv7: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArmv7 + run: | + ./containerBuilders/createBuildImage.sh bullseye arm/v7 go1.20.4.linux-armv6l.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh bullseye arm/v7 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: BullseyeServerPackageArmv7 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestBullseyeArmv7: + needs: BuildBullseyeArmv7 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: BullseyeServerPackageArmv7 + path: out + + - name: TestingPackageArmv7 + run: | + ./containerBuilders/createTestingImage.sh bullseye arm/v7 + ./testScripts/startServerPackageTest.sh bullseye arm/v7 + + BuildBookwormArm64: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArm64 + run: | + ./containerBuilders/createBuildImage.sh bookworm arm64 go1.20.4.linux-arm64.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh bookworm arm64 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: BookwormServerPackageArm64 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestBookwormArm64: + needs: BuildBookwormArm64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: BookwormServerPackageArm64 + path: out + + - name: TestingPackageArm64 + run: | + ./containerBuilders/createTestingImage.sh bookworm arm64 + ./testScripts/startServerPackageTest.sh bookworm arm64 + + BuildBookwormArmv7: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArmv7 + run: | + ./containerBuilders/createBuildImage.sh bookworm arm/v7 go1.20.4.linux-armv6l.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh bookworm arm/v7 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: BookwormServerPackageArmv7 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestBookwormArmv7: + needs: BuildBookwormArmv7 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: BookwormServerPackageArmv7 + path: out + + - name: TestingPackageArmv7 + run: | + ./containerBuilders/createTestingImage.sh bookworm arm/v7 + ./testScripts/startServerPackageTest.sh bookworm arm/v7 + + BuildFocalArm64: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArm64 + run: | + ./containerBuilders/createBuildImage.sh focal arm64 go1.20.4.linux-arm64.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh focal arm64 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: FocalServerPackageArm64 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestFocalArm64: + needs: BuildFocalArm64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: FocalServerPackageArm64 + path: out + + - name: TestingPackageArm64 + run: | + ./containerBuilders/createTestingImage.sh focal arm64 + ./testScripts/startServerPackageTest.sh focal arm64 + + BuildFocalArmv7: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArmv7 + run: | + ./containerBuilders/createBuildImage.sh focal arm/v7 go1.20.4.linux-armv6l.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh focal arm/v7 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: FocalServerPackageArmv7 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestFocalArmv7: + needs: BuildFocalArmv7 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: FocalServerPackageArmv7 + path: out + + - name: TestingPackageArmv7 + run: | + ./containerBuilders/createTestingImage.sh focal arm/v7 + ./testScripts/startServerPackageTest.sh focal arm/v7 + + BuildJammyArm64: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArm64 + run: | + ./containerBuilders/createBuildImage.sh jammy arm64 go1.20.4.linux-arm64.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh jammy arm64 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: JammyServerPackageArm64 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestJammyArm64: + needs: BuildJammyArm64 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: JammyServerPackageArm64 + path: out + + - name: TestingPackageArm64 + run: | + ./containerBuilders/createTestingImage.sh jammy arm64 + ./testScripts/startServerPackageTest.sh jammy arm64 + + BuildJammyArmv7: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - name: BuildPackageArmv7 + run: | + ./containerBuilders/createBuildImage.sh jammy arm/v7 go1.20.4.linux-armv6l.tar.gz + VERSION=10.0.1 ./compileScripts/buildServerPackage.sh jammy arm/v7 + + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: JammyServerPackageArmv7 + path: | + out/**/built-seafile-server-pkgs/*.tar.gz + + TestJammyArmv7: + needs: BuildJammyArmv7 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: PrepareHost + run: | + ./githubActionsHelper/prepareHost.sh + + - uses: actions/download-artifact@v3 + with: + name: JammyServerPackageArmv7 + path: out + + - name: TestingPackageArmv7 + run: | + ./containerBuilders/createTestingImage.sh jammy arm/v7 + ./testScripts/startServerPackageTest.sh jammy arm/v7 diff --git a/.gitignore b/.gitignore index 876e401..c86aa55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,5 @@ # output folders -build/ -seafile-sources/ -seafile-server-pkgs/ - -# build artefacts -.build.sh.swp +out # MacOS .DS_Store @@ -14,3 +9,6 @@ seafile-server-pkgs/ # VSCode .vscode + +# dotenv +.env diff --git a/CONTRIBUTORS b/CONTRIBUTORS deleted file mode 100644 index ea7602e..0000000 --- a/CONTRIBUTORS +++ /dev/null @@ -1,7 +0,0 @@ -# This is the official list of people who can contribute -# (and typically have contributed) code to the seafile-rpi repository. - -# Names should be added to this file like so: -jobenvil -towa48 -thrynir diff --git a/README.md b/README.md index 0e2a695..f595445 100644 --- a/README.md +++ b/README.md @@ -1,113 +1,110 @@ -Seafile server package for Raspberry Pi. Maintained by seafile community. +# Seafile server packages for ARM +This repository contains a list of scripts to compile Seafile for arm/v7 and arm64. ## Download - -- The latest **stable** rpi version is [here](https://github.com/haiwen/seafile-rpi/releases/latest). - -## Build - -E.g. to compile Seafile server v10.0.1: - -```shell -$ wget https://raw.githubusercontent.com/haiwen/seafile-rpi/master/build.sh -$ chmod u+x build.sh -$ sudo ./build.sh -DTA -v 10.0.1 -h https://github.com/haiwen/seafile-rpi/blob/feat/master/requirements/seahub_requirements_v10.0.1.txt -d https://github.com/haiwen/seafile-rpi/blob/feat/master/requirements/seafdav_requirements_v10.0.1.txt -``` - -Calling `./build.sh` without arguments will return usage information and a list of all available arguments: - -```shell -seafile@rpi-focal:~$ sudo ./build.sh - -Usage: - build.sh [OPTIONS] - - OPTIONS: - -D Install build dependencies - -T Install thirdparty requirements - - -1 Build/update libevhtp - -2 Build/update libsearpc - -3 Build/update seafile (c_fileserver) - -4 Build/update seafile (go_fileserver) - -5 Build/update seafile (notification_server) - -6 Build/update seahub - -7 Build/update seafobj - -8 Build/update seafdav - -9 Build/update Seafile server - - -A All options -1 to -9 in one go - - -v Set seafile server version to build - default: 10.0.1 - -r Set libsearpc version - default: 3.3-latest - -f Set fixed libsearpc version - default: 3.1.0 - -h Set python requirement file for seahub - default: https://raw.githubusercontent.com/haiwen/seahub/v10.0.1-server/requirements.txt - -d Set python requirement file for seafdav - default: https://raw.githubusercontent.com/haiwen/seafdav/v10.0.1-server/requirements.txt - - use --version for version info of this script. -``` - -Schema of created directory structure after execution of `./build.sh`: - -``` -seafile@rpi-focal:~$ tree . -L 3 -. -├── build.sh -├── build-server.py.patch -├── built-seafile-server-pkgs -│   └── seafile-server-10.0.1-focal-armv7l.tar.gz -├── built-seafile-sources -│   └── R10.0.1 -├── go -│   └── pkg -├── haiwen-build -│   ├── libevhtp -│   ├── libsearpc -│   ├── seafdav -│   ├── seafile-server -│   ├── seafobj -│   ├── seahub -│   └── seahub_thirdparty -└── opt -    └── local -``` - -## Batch Build - -If you want to build for multiple distributions and architectures via lxc containers you can run: - -```shell -$ wget https://raw.githubusercontent.com/haiwen/seafile-rpi/master/build-batch.sh -$ chmod u+x build-batch.sh -$ sudo time bash ./build-batch.sh 10.0.1 +The latest **stable** arm builds are [here](https://github.com/lanmarc77/seafile-arm/releases). + +Usually these are built automatically and run through some basic automatic tests to see if the build at least installs and starts on the supported Linux distributions. + +## Building +The build process requires docker to be installed. It has only been tested on x86_x64 machines and builds the arm packages using docker multiarch support. +It is designed to run with GitHub actions but can also be run manually. + +### Build Online +Just execute the action, check the build results and take the tar.gz files from the generated artifacts. +For unknown reasons GitHub actions does not build arm/v7 packages inside the pipeline. Manual builds work though. + +### Build manually +Clone this repository. Make sure docker is installed and running. + +#### Building the server packages +Just call the build script as needed: + +```./manualBuildAndTest/buildAllArmv7.sh``` +(for building all arm/v7 packages for all supported distributions) + +``` ./manualBuildAndTest/buildAllArm64.sh``` +(for building all arm64 packages for all supported distributions) + +The builds should stop and display an error message if something goes wrong. Otherwise server packages are located in the ./out directory. +Building can easily take more than one hour. Be patient. + +#### Testing the server packages +After the server packages have been build they can be tested. Tests include installing the server package in a brand new distribution default container and letting it run with sqlite and mysql/mariadb backends. + +```./manualBuildAndTest/testAllArmv7.sh``` +(for testing all arm/v7 packages for all supported distributions) + +```./manualBuildAndTest/testAllArm64.sh``` +(for testing all arm64 packages for all supported distributions) + +The tests should stop and display an error message if something goes wrong. + +## Repository structure / build system architecture +One server package build and it's test are conducted in the following way: + ``` - -Edit the script in order to build for your preferred distributions. - -If want to execute the script in the background with logs written to `build-batch.log` call: -```shell -sudo su -nohup bash -c "sudo time bash ./build-batch.sh 9.0.9" >build-batch.log 2>build-batch.log < /dev/null & + create a docker build image using the needed + Linux distribution and architecture + (result: runnable docker container) + | + v + run the compilation and packaging script + inside the build image + (result: .tar.gz server package in ./out) + | + v + create a docker test image using the needed + Linux distribution and architecture + (result: runnable docker container) + | + v + run the test script inside the test image + with the .tar.gz server package + (result: ideally no error message :-)) + ``` -## Manual and Guides - -- [Build Seafile server](https://manual.seafile.com/build_seafile/rpi/) -- [Deploy Seafile server](https://manual.seafile.com/deploy/) - -## Reporting Issues / GitHub Issues - -If you have any problems or suggestions when using the seafile rpi server package, please report it -on [seafile server forum](https://forum.seafile.com/). - -**GitHub Issues support is dropped** and will not be maintained anymore. If you need help, clarification or report some -weird behaviour, please post it on the [seafile server forum](https://forum.seafile.com/) as well. - -## Contributors +The following directories are part of this repository (in logic order as described above): +### .github +Contains the main.yml file. It basically only calls the below described scripts in the right order with right parameters to try to build and test all distributions and architectures. +Usually setup to compile and test the latest Seafile version. +### containerBuilders +Contains one script for creating the docker container that builds the server packages as well as one for creating the docker containers that lets the tests run for the build server package. +The two subfolders contain the dockerfile definitions for the containers. +All scripts have small documentation on top which describe their parameters. +### compileScripts +The buildServerPackage.sh script is the initiator which starts a fitting previously created build container and then runs one of compileSeafile*.sh in it to actually compile and build the server package. The buildServerPackage.sh script is the script which determines the Seafile version to be compiled. +If a version specific compileSeafile script exists it is used. Otherwise the compileSeafile_default.sh script is used. +All scripts have small documentation on top which describe their parameters. +### testScripts +The startServerPackageTest.sh script is the initiator which starts a fitting previously built testing container and then runs one of runTest*.sh in it to actually compile and build the server package. +If a version specific runTest script exists it is used. Otherwise the runTest_default.sh script is used. +All scripts have small documentation on top which describe their parameters. +### githubActionsHelper +Only contains one script currently to prepare the build host inside the GitHub pipeline to use a modern docker. +### manualBuildAndTest +Contains script for compiling and testing manually/locally outside the GitHub pipeline. +The buildAll*.sh scripts try to build all server packages for all distributions and architectures that are supported. +The testAll*.sh scripts then starts testing the server packages for all distributions and architectures that are supported. +Both scripts contain code to build the docker build and test containers. +Usually setup to compile and test the latest Seafile version. +The dockerReset.sh clean/resets the local docker setup and is used in the above scripts. + +## New version adjustments +TODO: explain the steps needed to adjust the scripts to compile for a new/different Seafile version. + +## Issues, challenges +### General topics +* Rust +On each build the newest Rust version is downloaded and used. So while a current Rust version works this might change in the future. +* Go +Instead of using a most likely very old Go version a specific Go version is downloaded and used. It is unclear how long older Go versions stay available for downloaded. + +### Seafile v10.0.1 +The following changes are done by the compileSeafile_v10.0.1.sh to fix issues: +* Markup +Markup was fixed to version 2.0.1 in the requirements.txt +* Compile patch +A patch was introduced to also build the newly introduced notification-server -See [CONTRIBUTORS](https://github.com/haiwen/seafile-rpi/graphs/contributors). diff --git a/build-batch.sh b/build-batch.sh deleted file mode 100644 index ce3bbfd..0000000 --- a/build-batch.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash - -# Set the version which needs to be build -VERSION=${1:-'9.0.9'} - -echo "Get the current build script" -wget -O build.sh https://raw.githubusercontent.com/haiwen/seafile-rpi/master/build.sh -chmod u+x build.sh - -# Set the arch name for the armhf distros -sysArch=$(arch) -[ "$sysArch" == "aarch64" ] && archhfName='armv8l' || archhfName='armv7l' - -declare -A lxcDistroMap=(["bullseye"]="debian/11/" ["buster"]="debian/10/" ["stretch"]="debian/9/" ["kinetic"]="ubuntu/22.10/" ["jammy"]="ubuntu/22.04/" ["focal"]="ubuntu/20.04/" ["bionic"]="ubuntu/18.04/") - -# Assign the distros which need to be build -configLxcDistros=("jammy" "focal" "bionic" "bullseye" "buster") -configLxcArchs=("armhf") -if [[ "$sysArch" == "aarch64" ]]; then - # Only add arm64 if system supports it - configLxcArchs+=("arm64") -fi - -lxcContainers=() -for lxcArch in "${configLxcArchs[@]}"; do - for lxcDistro in "${configLxcDistros[@]}"; do - lxcContainers+=("${lxcDistro}-${lxcArch}") - done -done - -echo "Building following distributions and architectures: " -echo "${lxcContainers[@]}" - -# Execute the builds -for container in "${lxcContainers[@]}"; do - archShort=${container#*-} - distroName=${container%-*} - [ "$archShort" == "arm64" ] && architecture='aarch64' || architecture=$archhfName - echo -e "\n######################################################\n" - echo "Distribution: $distroName" - echo "Architecture: $architecture" - - exists=false - { - lxc info $container && - exists=true - } - if $exists; then - echo "Starting existing Lxc image $container" - lxc start $container - else - echo "Launching Lxc images:${lxcDistroMap[$distroName]}$archShort $container" - lxc launch images:"${lxcDistroMap[$distroName]}"$archShort $container - fi - - if ! lxc exec $container -- /bin/bash -c "sudo -V" &>/dev/null; then - echo "Install 'sudo'" - lxc exec $container -- apt install sudo - fi - - if ! lxc exec $container -- id seafile &>/dev/null; then - echo "Add 'seafile' as user" - lxc exec $container -- useradd -m -s /bin/bash seafile - fi - - if ! lxc exec $container -- /bin/bash -c "sudo -l -U seafile" &>/dev/null; then - echo "Give 'seafile' super user privileges" - lxc exec $container -- /bin/bash -c "echo 'seafile ALL=(ALL) NOPASSWD: ALL' | sudo EDITOR='tee -a' visudo" - fi - - echo "Building for container: $container" - lxc file push build.sh $container/home/seafile/ - - NETWORK_ATTEMPTS=0 - while [ "$(lxc exec ${container} -- bash -c 'hostname -I' 2>/dev/null)" = "" ]; do - ((NETWORK_ATTEMPTS++)) - echo -e "\e[1A\e[KNo network available in $container (attempt $NETWORK_ATTEMPTS): $(date)" - if [ $NETWORK_ATTEMPTS -gt 120 ]; then - continue 2 - fi - sleep .5 - done - echo -e "\e[1A\e[KNetwork available in $container" - - echo "Upgrade container packages: $container" - lxc exec $container -- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade - - echo "Execute build.sh for $container" - lxc exec $container -- su - seafile -c "sudo ./build.sh -DTA -v $VERSION \ - -h https://raw.githubusercontent.com/haiwen/seafile-rpi/master/requirements/seahub_requirements_v${VERSION}.txt \ - -d https://raw.githubusercontent.com/haiwen/seafile-rpi/master/requirements/seafdav_requirements_v${VERSION}.txt" - filename=$(lxc exec $container -- bash -c "ls /home/seafile/built-seafile-server-pkgs/seafile-server-$VERSION-*.tar.gz" 2>/dev/null) - lxc file pull "$container$filename" ./ - - echo -e "Build finished for container $container\n\n" - lxc stop $container -done - -echo "Building distros finished" diff --git a/build.sh b/build.sh deleted file mode 100755 index 2b579b3..0000000 --- a/build.sh +++ /dev/null @@ -1,745 +0,0 @@ -#!/bin/bash -[[ "$1" =~ ^(--version)$ ]] && { - echo "2023-05-13"; - exit 0 -}; - -# -# CONST -# - -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" -BUILDFOLDER="haiwen-build" -BUILDPATH="${SCRIPTPATH}/${BUILDFOLDER}" -THIRDPARTYFOLDER="${BUILDPATH}/seahub_thirdparty" -PKGSOURCEDIR="built-seafile-sources" -PKGDIR="built-seafile-server-pkgs" -DISTRO=`lsb_release -d | awk '{ print $2 }'` -ARCH=$(arch) -PREFIX="${HOME}/opt/local" -# Temporary folder for seafile-server dependency builds for shared libraries (ld) -# see https://github.com/haiwen/seahub/blob/eab3ba2f6d3a311728130d8752c716e782b8d62e/scripts/build/build-server.py#L324 - -LIBSEARPC_VERSION_LATEST="3.3-latest" # check if new tag is available on https://github.com/haiwen/libsearpc/releases -LIBSEARPC_VERSION_FIXED="3.1.0" # libsearpc sticks to 3.1.0 https://github.com/haiwen/libsearpc/commit/43d768cf2eea6afc6e324c2b1a37a69cd52740e3 -VERSION="10.0.1" -VERSION_SEAFILE="6.0.1" # dummy version for seafile (see configure.ac) -MYSQL_CONFIG_PATH="/usr/bin/mysql_config" # ensure compilation with mysql support - -VERSION_TAG="v${VERSION}-server" -LIBSEARPC_TAG="v${LIBSEARPC_VERSION_LATEST}" -PYTHON_REQUIREMENTS_URL_SEAHUB="https://raw.githubusercontent.com/haiwen/seahub/${VERSION_TAG}/requirements.txt" # official requirements.txt file -PYTHON_REQUIREMENTS_URL_SEAFDAV="https://raw.githubusercontent.com/haiwen/seafdav/${VERSION_TAG}/requirements.txt" - -STEPS=0 -STEPCOUNTER=0 - -CONF_INSTALL_DEPENDENCIES=false -CONF_INSTALL_THIRDPART=false -CONF_BUILD_LIBEVHTP=false -CONF_BUILD_LIBSEARPC=false -CONF_BUILD_SEAFILE=false -CONF_BUILD_SEAFILE_GO_FILESERVER=false -CONF_BUILD_SEAFILE_NOTIFICATION_SERVER=false -CONF_BUILD_SEAHUB=false -CONF_BUILD_SEAFOBJ=false -CONF_BUILD_SEAFDAV=false -CONF_BUILD_SEAFILE_SERVER=false -PREP_BUILD=false -COPY_PKG_SOURCE=false - -# colors used in functions for better readability -TXT_YELLOW="\033[93m" -TXT_DGRAY="\033[1;30m" -TXT_LGRAY="\033[0;37m" -TXT_LRED="\033[1;31m" -TXT_RED="\033[0;31m" -TXT_BLUE="\033[0;34m" -TXT_GREEN="\033[0;32m" -TXT_BOLD="\033[1m" -TXT_ITALIC="\033[3m" -TXT_UNDERSCORE="\033[4m" -# 48;5 for background, 38;5 for foreground -TXT_GREEN_ON_GREY="\033[48;5;240;38;5;040m" -TXT_ORANGE_ON_GREY="\033[48;5;240;38;5;202m" -OFF="\033[0m" - -msg() -{ - echo -e "\n${TXT_YELLOW}$1${OFF}\n" -} - -error() -{ - echo -e "${TXT_LRED}error:${OFF} $1"; - exit 1 -} - -alldone() -{ - echo -e " ${TXT_GREEN}done! ${OFF}" -} - -mkmissingdir() -{ - if [ ! -d "${1}" ]; then - echo -en "create missing directory ${TXT_BLUE}$1${OFF}..."; - mkdir -p "${1}" || error "failed!"; - alldone; - fi -} - -exitonfailure() -{ - if [ $? -ne 0 ]; then - error "$1" - fi -} - -if [[ $1 == "" ]] ; then - echo -e " -Usage: - ${TXT_BOLD}build.sh${OFF} ${TXT_DGRAY}${TXT_ITALIC}[OPTIONS]${OFF} - - ${TXT_UNDERSCORE}OPTIONS${OFF}: - ${TXT_BOLD}-D${OFF} Install build dependencies - ${TXT_BOLD}-T${OFF} Install thirdparty requirements - - ${TXT_BOLD}-1${OFF} Build/update libevhtp - ${TXT_BOLD}-2${OFF} Build/update libsearpc - ${TXT_BOLD}-3${OFF} Build/update seafile (c_fileserver) - ${TXT_BOLD}-4${OFF} Build/update seafile (go_fileserver) - ${TXT_BOLD}-5${OFF} Build/update seafile (notification_server) - ${TXT_BOLD}-6${OFF} Build/update seahub - ${TXT_BOLD}-7${OFF} Build/update seafobj - ${TXT_BOLD}-8${OFF} Build/update seafdav - ${TXT_BOLD}-9${OFF} Build/update Seafile server - - ${TXT_BOLD}-A${OFF} All options ${TXT_BOLD}-1${OFF} to ${TXT_BOLD}-9${OFF} in one go - - ${TXT_BOLD}-v${OFF} ${TXT_RED}${TXT_ITALIC}${OFF} Set seafile server version to build - ${TXT_LGRAY}default:${OFF} ${TXT_BLUE}${VERSION}${OFF} - ${TXT_BOLD}-r${OFF} ${TXT_RED}${TXT_ITALIC}${OFF} Set libsearpc version - ${TXT_LGRAY}default:${OFF} ${TXT_BLUE}${LIBSEARPC_VERSION_LATEST}${OFF} - ${TXT_BOLD}-f${OFF} ${TXT_RED}${TXT_ITALIC}${OFF} Set fixed libsearpc version - ${TXT_LGRAY}default:${OFF} ${TXT_BLUE}${LIBSEARPC_VERSION_FIXED}${OFF} - ${TXT_BOLD}-h${OFF} ${TXT_RED}${TXT_ITALIC}${OFF} Set python requirement file for seahub - ${TXT_LGRAY}default:${OFF} ${TXT_BLUE}${PYTHON_REQUIREMENTS_URL_SEAHUB}${OFF} - ${TXT_BOLD}-d${OFF} ${TXT_RED}${TXT_ITALIC}${OFF} Set python requirement file for seafdav - ${TXT_LGRAY}default:${OFF} ${TXT_BLUE}${PYTHON_REQUIREMENTS_URL_SEAFDAV}${OFF} - - ${TXT_DGRAY}use${OFF} ${TXT_BOLD}--version${OFF} ${TXT_DGRAY}for version info of this script.${OFF} -" - exit 0 -fi - -# get the options -while getopts ":123456789ADTv:r:f:h:d:" OPT; do - case $OPT in - D) CONF_INSTALL_DEPENDENCIES=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - T) CONF_INSTALL_THIRDPART=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 1) CONF_BUILD_LIBEVHTP=true >&2 - PREP_BUILD=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 2) CONF_BUILD_LIBSEARPC=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 3) CONF_BUILD_SEAFILE=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 4) CONF_BUILD_SEAFILE_GO_FILESERVER=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 5) CONF_BUILD_SEAFILE_NOTIFICATION_SERVER=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 6) CONF_BUILD_SEAHUB=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 7) CONF_BUILD_SEAFOBJ=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 8) CONF_BUILD_SEAFDAV=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - 9) CONF_BUILD_SEAFILE_SERVER=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+1)) >&2 - ;; - A) CONF_BUILD_LIBEVHTP=true >&2 - CONF_BUILD_LIBSEARPC=true >&2 - CONF_BUILD_SEAFILE=true >&2 - CONF_BUILD_SEAFILE_GO_FILESERVER=true >&2 - CONF_BUILD_SEAFILE_NOTIFICATION_SERVER=true >&2 - CONF_BUILD_SEAHUB=true >&2 - CONF_BUILD_SEAFOBJ=true >&2 - CONF_BUILD_SEAFDAV=true >&2 - CONF_BUILD_SEAFILE_SERVER=true >&2 - PREP_BUILD=true >&2 - COPY_PKG_SOURCE=true >&2 - STEPS=$((STEPS+9)) >&2 - ;; - v) VERSION=$OPTARG >&2 - VERSION_TAG="v${VERSION}-server" >&2 - PYTHON_REQUIREMENTS_URL_SEAHUB="https://raw.githubusercontent.com/haiwen/seahub/${VERSION_TAG}/requirements.txt" >&2 - PYTHON_REQUIREMENTS_URL_SEAFDAV="https://raw.githubusercontent.com/haiwen/seafdav/${VERSION_TAG}/requirements.txt" >&2 - ;; - r) LIBSEARPC_VERSION_LATEST=$OPTARG >&2 - LIBSEARPC_TAG="v${LIBSEARPC_VERSION_LATEST}" >&2 - ;; - f) LIBSEARPC_VERSION_FIXED=$OPTARG >&2 - ;; - h) PYTHON_REQUIREMENTS_URL_SEAHUB=$OPTARG >&2 - ;; - d) PYTHON_REQUIREMENTS_URL_SEAFDAV=$OPTARG >&2 - ;; - \?) - error "Invalid option: ${TXT_BOLD}-$OPTARG${OFF}" >&2 - ;; - :) - error "Option ${TXT_BOLD}-$OPTARG${OFF} requires an argument." >&2 - ;; - esac -done - - -# set counter accordingly -${PREP_BUILD} && STEPS=$((STEPS+2)) -${COPY_PKG_SOURCE} && STEPS=$((STEPS+1)) - -mkmissingdir "${BUILDPATH}" - -# -# START -# - -echo_start() -{ - msg "Build seafile-rpi ${VERSION_TAG}" -} - -# -# INSTALL DEPENDENCIES -# - -install_dependencies() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Install dependencies" - - # https://github.com/haiwen/seafile/issues/1158 - # onigposix (libonig-dev) is dependency for /usr/local/include/evhtp.h - - msg "Downloads the package lists from the repositories and updates them" - (set -x; apt-get update) - msg "Install build-essential package" - (set -x; apt-get install -y build-essential) - msg "Install build dependencies" - (set -x; apt-get install -y \ - cargo \ - cmake \ - git \ - golang-go \ - intltool \ - libarchive-dev \ - libcurl4-openssl-dev \ - libevent-dev \ - libffi-dev \ - libfuse-dev \ - libglib2.0-dev \ - libjansson-dev \ - libjpeg-dev \ - libjwt-dev \ - libldap2-dev \ - libmariadbclient-dev-compat \ - libonig-dev \ - libpq-dev \ - libsqlite3-dev \ - libssl-dev \ - libtool \ - libxml2-dev \ - libxslt-dev \ - python3-distro \ - python3-lxml \ - python3-ldap \ - python3-pip \ - python3-setuptools \ - python3-wheel \ - uuid-dev \ - valac \ - wget) -} - -# -# PREPARE build (without privileges) -# - -prepare_build() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Prepare build" - - mkmissingdir "${PREFIX}" - msg " Export LIBRARY_PATH, LD_LIBRARY_PATH, CPATH" - export LIBRARY_PATH="${PREFIX}/lib" - export LD_LIBRARY_PATH="${PREFIX}/lib" - export CPATH="${PREFIX}/include" - - # print ${LIBRARY_PATH}, ${LD_LIBRARY_PATH} and ${CPATH} - msg " LIBRARY_PATH = ${LIBRARY_PATH} " - msg " LD_LIBRARY_PATH = ${LD_LIBRARY_PATH} " - msg " CPATH = ${CPATH} " -} - -# -# BUILD libevhtp -# - -build_libevhtp() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build libevhtp" - - cd "${BUILDPATH}" - - if [ -d "libevhtp" ]; then - cd libevhtp - (set -x; make clean) - (set -x; git fetch origin --tags) - (set -x; git reset --hard origin/master) - else - (set -x; git clone "https://www.github.com/haiwen/libevhtp.git") - cd libevhtp - fi - (set -x; cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .) - (set -x; make) - (set -x; make install) - exitonfailure "Build libevhtp failed" - cd "${SCRIPTPATH}" -} - -# -# PREPARE libs -# - -export_pkg_config_path() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Prepare libs" - # Export PKG_CONFIG_PATH for seafile-server and libsearpc - msg " Export PKG_CONFIG_PATH for seafile-server and libsearpc" - export PKG_CONFIG_PATH="${BUILDPATH}/libsearpc:${PKG_CONFIG_PATH}" - export PKG_CONFIG_PATH="${BUILDPATH}/seafile-server/lib:${PKG_CONFIG_PATH}" - - # print ${PKG_CONFIG_PATH} - msg " PKG_CONFIG_PATH = ${PKG_CONFIG_PATH} " -} - -# -# BUILD libsearpc -# - -build_libsearpc() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build libsearpc" - - cd "${BUILDPATH}" - if [ -d "libsearpc" ]; then - cd libsearpc - (set -x; make clean && make distclean) - (set -x; git fetch origin --tags) - (set -x; git reset --hard origin/master) - else - (set -x; git clone "https://github.com/haiwen/libsearpc.git") - cd libsearpc - fi - (set -x; git reset --hard "${LIBSEARPC_TAG}") - (set -x; ./autogen.sh) - (set -x; ./configure) - (set -x; make dist) - exitonfailure "Build libsearpc failed" - cd "${SCRIPTPATH}" -} - -# -# BUILD seafile (c_fileserver) -# - -build_seafile() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build seafile-server (c_fileserver)" - - cd "${BUILDPATH}" - if [ -d "seafile-server" ]; then - cd seafile-server - (set -x; make clean && make distclean) - (set -x; git fetch origin --tags) - (set -x; git reset --hard origin/master) - else - (set -x; git clone "https://github.com/haiwen/seafile-server.git") - cd seafile-server - fi - (set -x; git reset --hard "${VERSION_TAG}") - (set -x; ./autogen.sh) - (set -x; ./configure --with-mysql=${MYSQL_CONFIG_PATH} --enable-ldap) - (set -x; make dist) - exitonfailure "Build seafile-server failed" - cd "${SCRIPTPATH}" -} - -# -# BUILD seafile (go_fileserver) -# - -build_seafile_go_fileserver() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build seafile-server (go_fileserver)" - - cd "${BUILDPATH}" - if [ -d "seafile-server" ]; then - cd seafile-server - (set -x; make clean && make distclean) - (set -x; git fetch origin --tags) - (set -x; git reset --hard origin/master) - else - (set -x; git clone "https://github.com/haiwen/seafile-server.git") - cd seafile-server - fi - (set -x; git reset --hard "${VERSION_TAG}") - (set -x; cd fileserver && go build .) - exitonfailure "Build seafile-server (go_fileserver) failed" - cd "${SCRIPTPATH}" -} - -# -# BUILD seafile (notification_server) -# - -build_seafile_notification_server() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build seafile-server (notification_server)" - - cd "${BUILDPATH}" - if [ -d "seafile-server" ]; then - cd seafile-server - (set -x; make clean && make distclean) - (set -x; git fetch origin --tags) - (set -x; git reset --hard origin/master) - else - (set -x; git clone "https://github.com/haiwen/seafile-server.git") - cd seafile-server - fi - (set -x; git reset --hard "${VERSION_TAG}") - (set -x; cd notification-server && go build .) - exitonfailure "Build seafile-server (notification_server) failed" - cd "${SCRIPTPATH}" -} - -# -# INSTALL thirdparty requirements -# - -install_thirdparty() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Install Seafile thirdparty requirements" - - # if distro and arch matches, add piwheels to pip config file - msg " Only add \"piwheels\" to pip config file if distro is DEBIAN (Buster or Bullseye) and the architecture is ARM." - if [ "${DISTRO}" = Debian -o "${DISTRO}" = Raspbian ] && [ "${ARCH}" = armv7l -o "${ARCH}" = armv8l -o "${ARCH}" = aarch64 ]; then - msg " Detected \"${DISTRO}\" distro for \"${ARCH}\". We can make use of \"piwheels\", pre-compiled binary Python packages." - if [ ! -f "${HOME}/.config/pip/pip.conf" ]; then - msg " Adding \"piwheels\" to pip config file under '${HOME}/.config/pip/pip.conf'..." - mkdir -p "${HOME}/.config" "${HOME}/.config/pip" && touch "${HOME}/.config/pip/pip.conf" - echo "[global]" > "${HOME}/.config/pip/pip.conf" - echo "extra-index-url=https://www.piwheels.org/simple" >> "${HOME}/.config/pip/pip.conf" - msg " Added 'extra-index-url=https://www.piwheels.org/simple' to pip config file." - else - msg " The pip config file '${HOME}/.config/pip/pip.conf' is already present on the system." - if grep -Fxq "extra-index-url=https://www.piwheels.org/simple" ${HOME}/.config/pip/pip.conf; then - msg " Found the line 'extra-index-url=https://www.piwheels.org/simple' already inside of the pip config file '${HOME}/.config/pip/pip.conf'." - else - msg " Adding 'extra-index-url=https://www.piwheels.org/simple' to '${HOME}/.config/pip/pip.conf'" - echo "[global]" >> "${HOME}/.config/pip/pip.conf" - echo "extra-index-url=https://www.piwheels.org/simple" >> "${HOME}/.config/pip/pip.conf" - msg " Added 'extra-index-url=https://www.piwheels.org/simple' to the pip config file." - fi - fi - fi - - # While pip alone is sufficient to install from pre-built binary archives, up to date copies of the setuptools and wheel projects are useful to ensure we can also install from source archives - # e.g. default shipped pip=9.0.1 in Ubuntu Bionic => need update to pip=20.* - # script executed like as seafile user, therefore pip upgrade only for seafile user, not system wide; pip installation goes to /home/seafile/.local/lib/python3.6/site-packages - msg " Download and update pip(3), setuptools and wheel from PyPI" - (set -x; python3 -m pip install --user --upgrade pip setuptools wheel) - - mkmissingdir "${THIRDPARTYFOLDER}" - - # get Seahub thirdparty requirements directly from GitHub - msg " Get Seahub thirdparty requirements directly from GitHub" - (set -x; wget "$PYTHON_REQUIREMENTS_URL_SEAHUB" -O "${THIRDPARTYFOLDER}/requirements.txt") - exitonfailure "Unable to get Seahub requirements" - - # get SeafDAV thirdparty requirements directly from Github - msg " Get SeafDAV thirdparty requirements directly from GitHub" - (set -x; wget "$PYTHON_REQUIREMENTS_URL_SEAFDAV" -O "${THIRDPARTYFOLDER}/requirements_SeafDAV.txt") - exitonfailure "Unable to get Seafdav requirements" - # merge seahub and seafdav requirements in one file - (set -x; cat "${THIRDPARTYFOLDER}/requirements_SeafDAV.txt" >> "${THIRDPARTYFOLDER}/requirements.txt") - - # install Seahub and SeafDAV thirdparty requirements - # on pip=20.* DEPRECATION: --install-option: ['--install-lib', '--install-scripts'] - msg " Install Seahub and SeafDAV thirdparty requirements" - (set -x; python3 -m pip install -r "${THIRDPARTYFOLDER}/requirements.txt" --target "${THIRDPARTYFOLDER}" --no-cache --upgrade) - exitonfailure "Thirdparty requirements installation failed" - - # clean up - msg " Clean up" - rm "${THIRDPARTYFOLDER}/requirements.txt" "${THIRDPARTYFOLDER}/requirements_SeafDAV.txt" - rm -rf $(find . -name "__pycache__") -} - -# -# BUILD seahub -# - -build_seahub() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build seahub" - - # get source code - cd "${BUILDPATH}" - if [ -d "seahub" ]; then - cd seahub - (set -x; make clean) - (set -x; git fetch origin --tags) - (set -x; git reset --hard origin/master) - else - (set -x; git clone "https://github.com/haiwen/seahub.git") - cd seahub - fi - (set -x; git reset --hard "${VERSION_TAG}") - - # export ${THIRDPARTYFOLDER} to ${PATH} - msg " Export THIRDPARTYFOLDER to PATH" - export PATH="${THIRDPARTYFOLDER}:${PATH}" - # print ${PATH} which includes now ${THIRDPARTYFOLDER} - msg " PATH = ${PATH}" - - # export ${THIRDPARTYFOLDER} to $PYTHONPATH - msg " Export THIRDPARTYFOLDER to PYTHONPATH" - export PYTHONPATH="${THIRDPARTYFOLDER}" - # print $PYTHONPATH - msg " PYTHONPATH = $PYTHONPATH${OFF}" - - # to fix [ERROR] django-admin scripts not found in PATH - msg " export THIRDPARTYFOLDER/django/bin to PATH" - export PATH="${THIRDPARTYFOLDER}/django/bin:${PATH}" - msg " PATH = ${PATH}" - - # generate package - # if python != python3.6 we need to "sudo ln -s /usr/bin/python3.6 /usr/bin/python" or with "pyenv global 3.6.9" - (set -x; python3 "${BUILDPATH}/seahub/tools/gen-tarball.py" --version="${VERSION_SEAFILE}" --branch=HEAD) - exitonfailure "Build seahub failed" - cd "${SCRIPTPATH}" -} - -# -# BUILD seafobj -# - -build_seafobj() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build seafobj" - - cd "${BUILDPATH}" - if [ -d "seafobj" ]; then - cd seafobj - (set -x; git fetch origin --tags) - (set -x; git reset --hard origin/master) - else - (set -x; git clone "https://github.com/haiwen/seafobj.git") - cd seafobj - fi - (set -x; git reset --hard "${VERSION_TAG}") - (set -x; make dist) - exitonfailure "Build seafobj failed" - cd "${SCRIPTPATH}" -} - -# -# BUILD seafdav -# - -build_seafdav() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build seafdav" - - cd "${BUILDPATH}" - if [ -d "seafdav" ]; then - cd seafdav - (set -x; git fetch origin --tags) - (set -x; git reset --hard origin/master) - else - (set -x; git clone "https://github.com/haiwen/seafdav.git") - cd seafdav - fi - (set -x; git reset --hard "${VERSION_TAG}") - (set -x; make) - exitonfailure "Build seafdav failed" - cd "${SCRIPTPATH}" -} - -# -# COPY package sources -# - -copy_pkg_source() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Copy sources to ${PKGSOURCEDIR}/R${VERSION} " - - mkmissingdir "${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}" - for i in \ - "${BUILDPATH}/libsearpc/libsearpc-${LIBSEARPC_VERSION_FIXED}.tar.gz" \ - "${BUILDPATH}/seafile-server/seafile-${VERSION_SEAFILE}.tar.gz" \ - "${BUILDPATH}/seafile-server/fileserver/fileserver" \ - "${BUILDPATH}/seafile-server/notification-server/notification-server" \ - "${BUILDPATH}/seahub/seahub-${VERSION_SEAFILE}.tar.gz" \ - "${BUILDPATH}/seafobj/seafobj.tar.gz" \ - "${BUILDPATH}/seafdav/seafdav.tar.gz" - do - [ -f "$i" ] && (set -x; cp "$i" "${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}") - done -} - -# -# BUILD Seafile server -# - -build_server() -{ - STEPCOUNTER=$((STEPCOUNTER+1)) - msg "-> [${STEPCOUNTER}/${STEPS}] Build Seafile server" - - cd "${BUILDPATH}" - mkmissingdir "${SCRIPTPATH}/${PKGDIR}" - - # TODO: remove at seafile 10.0.2 release - msg "-> Patch build-server.py" - echo "--- build-server.py.old 2023-04-23 17:26:19.233328609 +0200 -+++ build-server.py 2023-04-23 17:22:58.625726460 +0200 -@@ -549,6 +549,15 @@ - - must_copy(src_go_fileserver, dst_bin_dir) - -+# copy notification_server "notification-server" to directory seafile-server/seafile/bin -+def copy_notification_server(): -+ builddir = conf[CONF_BUILDDIR] -+ srcdir = conf[CONF_SRCDIR] -+ src_notification_server = os.path.join(srcdir, 'notification-server') -+ dst_bin_dir = os.path.join(builddir, 'seafile-server', 'seafile', 'bin') -+ -+ must_copy(src_notification_server, dst_bin_dir) -+ - def copy_seafdav(): - dst_dir = os.path.join(conf[CONF_BUILDDIR], 'seafile-server', 'seahub', 'thirdpart') - tarball = os.path.join(conf[CONF_SRCDIR], 'seafdav.tar.gz') -@@ -578,6 +587,8 @@ - serverdir) - must_copy(os.path.join(scripts_srcdir, 'seafile.sh'), - serverdir) -+ must_copy(os.path.join(scripts_srcdir, 'seafile-monitor.sh'), -+ serverdir) - must_copy(os.path.join(scripts_srcdir, 'seahub.sh'), - serverdir) - must_copy(os.path.join(scripts_srcdir, 'reset-admin.sh'), -@@ -635,6 +646,9 @@ - # copy go_fileserver - copy_go_fileserver() - -+ # copy notification_server -+ copy_notification_server() -+ - def copy_pdf2htmlex(): - '''Copy pdf2htmlEX exectuable and its dependent libs''' - pdf2htmlEX_executable = find_in_path('pdf2htmlEX')" | patch -N -b -u "${BUILDPATH}/seahub/scripts/build/build-server.py" - - msg "-> Executing build-server.py" - (set -x; python3 "${BUILDPATH}/seahub/scripts/build/build-server.py" \ - --libsearpc_version="${LIBSEARPC_VERSION_FIXED}" \ - --seafile_version="${VERSION_SEAFILE}" \ - --version="${VERSION}" \ - --thirdpartdir="${THIRDPARTYFOLDER}" \ - --srcdir="${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}" \ - --mysql_config="${MYSQL_CONFIG_PATH}" \ - --outputdir="${SCRIPTPATH}/${PKGDIR}" \ - --yes) - exitonfailure "Build Seafile server failed" - cd "${SCRIPTPATH}" -} - -# -# COMPLETE -# - -echo_complete() -{ - msg "-> BUILD COMPLETED." -} - -# -# MAIN -# - -echo_start - -if ${PREP_BUILD} ; then - prepare_build - export_pkg_config_path -fi - -${CONF_INSTALL_DEPENDENCIES} && install_dependencies -${CONF_INSTALL_THIRDPART} && install_thirdparty - -${CONF_BUILD_LIBEVHTP} && build_libevhtp -${CONF_BUILD_LIBSEARPC} && build_libsearpc -${CONF_BUILD_SEAFILE} && build_seafile -${CONF_BUILD_SEAFILE_GO_FILESERVER} && build_seafile_go_fileserver -${CONF_BUILD_SEAFILE_NOTIFICATION_SERVER} && build_seafile_notification_server -${CONF_BUILD_SEAHUB} && build_seahub -${CONF_BUILD_SEAFOBJ} && build_seafobj -${CONF_BUILD_SEAFDAV} && build_seafdav - -${COPY_PKG_SOURCE} && copy_pkg_source - -${CONF_BUILD_SEAFILE_SERVER} && build_server - -echo_complete diff --git a/compileScripts/buildServerPackage.sh b/compileScripts/buildServerPackage.sh new file mode 100755 index 0000000..564751f --- /dev/null +++ b/compileScripts/buildServerPackage.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +#this script starts the prepared build container and the compiling process for building the package +#script parameters: (the script expects the version to build as environment variable) +# VERSION=[seafile-version] buildServerPackage.sh [distribution] [architecture] +#e.g. +# VERSION=10.0.1 buildServerPackage.sh buster arm64 +# VERSION=10.0.1 buildServerPackage.sh focal arm/v7 +# +# the package is output in the directory ../out + +cd $(dirname $0) +MY_DIR=$(pwd) +OUTPUT_DIR="../out" +mkdir $OUTPUT_DIR > /dev/null 2>&1 +cd $OUTPUT_DIR +OUTPUT_DIR=$(pwd) +cd $MY_DIR + +if [ -f "./compileSeafile_v${VERSION}.sh" ];then + cmd="/compileSeafile.sh && chown -R $(id -u):$(id -g) /built-seafile-server-pkgs" + USESCRIPT="v${VERSION}" +else + cmd="/compileSeafile.sh ${VERSION} && chown -R $(id -u):$(id -g) /built-seafile-server-pkgs" + USESCRIPT="default" +fi + + +docker run --rm \ + --platform linux/${2} \ + -m 6192M \ + --pull missing \ + --mount type=bind,src="./compileSeafile_${USESCRIPT}.sh",dst="/compileSeafile.sh" \ + -v "$OUTPUT_DIR/${2}/built-seafile-server-pkgs":/built-seafile-server-pkgs \ + seafile-builder:${1} /bin/bash -c "$cmd" + diff --git a/compileScripts/compileSeafile_default.sh b/compileScripts/compileSeafile_default.sh new file mode 100755 index 0000000..993eea7 --- /dev/null +++ b/compileScripts/compileSeafile_default.sh @@ -0,0 +1,244 @@ +#!/bin/bash + +VERSION="${1}" +PATH=~/.cargo/bin:$PATH +cargo -v +LIBSEARPC_VERSION_LATEST="3.3-latest" # check if new tag is available on https://github.com/haiwen/libsearpc/releases +LIBSEARPC_VERSION_FIXED="3.1.0" # libsearpc sticks to 3.1.0 https://github.com/haiwen/libsearpc/commit/43d768cf2eea6afc6e324c2b1a37a69cd52740e3 + +SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" +#" +BUILDFOLDER="haiwen-build" +BUILDPATH="${SCRIPTPATH}/${BUILDFOLDER}" +THIRDPARTYFOLDER="${BUILDPATH}/seahub_thirdparty" +PKGSOURCEDIR="built-seafile-sources" +PKGDIR="built-seafile-server-pkgs" +PREFIX="${HOME}/opt/local" +# Temporary folder for seafile-server dependency builds for shared libraries (ld) +# see https://github.com/haiwen/seahub/blob/eab3ba2f6d3a311728130d8752c716e782b8d62e/scripts/build/build-server.py#L324 + +VERSION_SEAFILE="6.0.1" # dummy version for seafile (see configure.ac) +MYSQL_CONFIG_PATH="/usr/bin/mysql_config" # ensure compilation with mysql support + +VERSION_TAG="v${VERSION}-server" +LIBSEARPC_TAG="v${LIBSEARPC_VERSION_LATEST}" + +# colors used in functions for better readability +TXT_YELLOW="\033[93m" +TXT_DGRAY="\033[1;30m" +TXT_LGRAY="\033[0;37m" +TXT_LRED="\033[1;31m" +TXT_RED="\033[0;31m" +TXT_BLUE="\033[0;34m" +TXT_GREEN="\033[0;32m" +TXT_BOLD="\033[1m" +TXT_ITALIC="\033[3m" +TXT_UNDERSCORE="\033[4m" +# 48;5 for background, 38;5 for foreground +TXT_GREEN_ON_GREY="\033[48;5;240;38;5;040m" +TXT_ORANGE_ON_GREY="\033[48;5;240;38;5;202m" +OFF="\033[0m" + +msg() +{ + echo -e "\n${TXT_YELLOW}$1${OFF}\n" +} + +error() +{ + echo -e "${TXT_LRED}error:${OFF} $1"; + exit 1 +} + +alldone() +{ + echo -e " ${TXT_GREEN}done! ${OFF}" +} + +mkmissingdir() +{ + if [ ! -d "${1}" ]; then + echo -en "create missing directory ${TXT_BLUE}$1${OFF}..."; + mkdir -p "${1}" || error "failed!"; + alldone; + fi +} + +exitonfailure() +{ + if [ $? -ne 0 ]; then + error "$1" + fi +} + + + +############################################# + +mkmissingdir "${BUILDPATH}" + +msg "Build seafile-rpi ${VERSION_TAG}" + +msg "-> [] Prepare build" +mkmissingdir "${PREFIX}" +msg " Export LIBRARY_PATH, LD_LIBRARY_PATH, CPATH" +export LIBRARY_PATH="${PREFIX}/lib" +export LD_LIBRARY_PATH="${PREFIX}/lib" +export CPATH="${PREFIX}/include" +msg " LIBRARY_PATH = ${LIBRARY_PATH} " +msg " LD_LIBRARY_PATH = ${LD_LIBRARY_PATH} " +msg " CPATH = ${CPATH} " +#apt-get install python3-venv -y +#(set -x;python3 -m venv venv) +#source venv/bin/activate +(set -x; python3 -m pip install -U setuptools wheel pip) + +msg "-> [] Prepare libs" +# Export PKG_CONFIG_PATH for seafile-server and libsearpc +msg " Export PKG_CONFIG_PATH for seafile-server and libsearpc" +export PKG_CONFIG_PATH="${BUILDPATH}/libsearpc:${PKG_CONFIG_PATH}" +export PKG_CONFIG_PATH="${BUILDPATH}/seafile-server/lib:${PKG_CONFIG_PATH}" +msg " PKG_CONFIG_PATH = ${PKG_CONFIG_PATH} " + +msg "-> [] getting all git repos first" +cd "${BUILDPATH}" +(set -x; git clone "https://www.github.com/haiwen/libevhtp.git") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/libsearpc.git") +cd libsearpc +(set -x; git reset --hard "${LIBSEARPC_TAG}") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/seahub.git") +cd seahub +(set -x; git reset --hard "${VERSION_TAG}") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/seafile-server.git") +cd seafile-server +(set -x; git reset --hard "${VERSION_TAG}") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/seafobj.git") +cd seafobj +(set -x; git reset --hard "${VERSION_TAG}") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/seafdav.git") +cd seafdav +(set -x; git reset --hard "${VERSION_TAG}") + +msg "-> [] Build libevhtp" +cd "${BUILDPATH}" +cd libevhtp +(set -x; cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .) +(set -x; make) +(set -x; make install) +exitonfailure "Build libevhtp failed" + +msg "-> [] Build libsearpc" +cd "${BUILDPATH}" +cd libsearpc +(set -x; ./autogen.sh) +(set -x; ./configure) +(set -x; make dist) +exitonfailure "Build libsearpc failed" + +msg "-> [] Build seahub" +cd "${BUILDPATH}" +cd seahub +msg " Export THIRDPARTYFOLDER to PATH" +export PATH="${THIRDPARTYFOLDER}:${PATH}" +msg " PATH = ${PATH}" +msg " Export THIRDPARTYFOLDER to PYTHONPATH" +export PYTHONPATH="${THIRDPARTYFOLDER}" +msg " PYTHONPATH = $PYTHONPATH${OFF}" +# to fix [ERROR] django-admin scripts not found in PATH +msg " export THIRDPARTYFOLDER/django/bin to PATH" +export PATH="${THIRDPARTYFOLDER}/django/bin:${PATH}" +msg " PATH = ${PATH}" +#we do this for seafdav and seahub here once +(set -x; python3 -m pip install -r "${BUILDPATH}/seafdav/requirements.txt" -r "${BUILDPATH}/seahub/requirements.txt" --target "${THIRDPARTYFOLDER}" --no-cache --upgrade) +# generate package +# if python != python3.6 we need to "sudo ln -s /usr/bin/python3.6 /usr/bin/python" or with "pyenv global 3.6.9" +(set -x; python3 "${BUILDPATH}/seahub/tools/gen-tarball.py" --version="${VERSION_SEAFILE}" --branch=HEAD) +exitonfailure "Build seahub failed" + +msg "-> [] Build seafile-server (c_fileserver)" +cd "${BUILDPATH}" +cd seafile-server +(set -x; ./autogen.sh) +(set -x; ./configure --with-mysql=${MYSQL_CONFIG_PATH} --enable-ldap) +(set -x; make dist) +exitonfailure "Build seafile-server failed" + +if [ -d "${BUILDPATH}/seafile-server/fileserver" ];then + msg "-> [] Build seafile-server (go_fileserver)" + cd "${BUILDPATH}" + cd seafile-server + (set -x; git reset --hard "${VERSION_TAG}") + (set -x; cd fileserver && CGO_ENABLED=0 go build .) + exitonfailure "Build seafile-server (go_fileserver) failed" +fi + +if [ -d "${BUILDPATH}/seafile-server/notification-server" ];then + msg "-> [] Build seafile-server (notification_server)" + cd "${BUILDPATH}" + cd seafile-server + (set -x; git reset --hard "${VERSION_TAG}") + (set -x; cd notification-server && CGO_ENABLED=0 go build .) + exitonfailure "Build seafile-server (notification_server) failed" +fi + +msg "-> [] Build seafobj" +cd "${BUILDPATH}" +cd seafobj +(set -x; make dist) +exitonfailure "Build seafobj failed" + +msg "-> [] Build seafdav" +cd "${BUILDPATH}" +cd seafdav +#also adding requirements file from seahub to avoid removal of bin dir contents +(set -x; make) +exitonfailure "Build seafdav failed" + +msg "-> [] Copy sources to ${PKGSOURCEDIR}/R${VERSION} " +mkmissingdir "${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}" +for i in \ + "${BUILDPATH}/libsearpc/libsearpc-${LIBSEARPC_VERSION_FIXED}.tar.gz" \ + "${BUILDPATH}/seafile-server/seafile-${VERSION_SEAFILE}.tar.gz" \ + "${BUILDPATH}/seafile-server/fileserver/fileserver" \ + "${BUILDPATH}/seafile-server/notification-server/notification-server" \ + "${BUILDPATH}/seahub/seahub-${VERSION_SEAFILE}.tar.gz" \ + "${BUILDPATH}/seafobj/seafobj.tar.gz" \ + "${BUILDPATH}/seafdav/seafdav.tar.gz" +do + [ -f "$i" ] && (set -x; cp "$i" "${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}") +done + +msg "-> [${STEPCOUNTER}/${STEPS}] Build Seafile server" +cd "${BUILDPATH}" +mkmissingdir "${SCRIPTPATH}/${PKGDIR}" + +msg "-> Executing build-server.py" +if [ -f "${BUILDPATH}/seahub/scripts/build/build-server.py" ]; then + (set -x; python3 "${BUILDPATH}/seahub/scripts/build/build-server.py" \ + --libsearpc_version="${LIBSEARPC_VERSION_FIXED}" \ + --seafile_version="${VERSION_SEAFILE}" \ + --version="${VERSION}" \ + --thirdpartdir="${THIRDPARTYFOLDER}" \ + --srcdir="${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}" \ + --mysql_config="${MYSQL_CONFIG_PATH}" \ + --outputdir="${SCRIPTPATH}/${PKGDIR}" \ + --yes) +else + (set -x; python3 "${BUILDPATH}/seafile-server/scripts/build/build-server.py" \ + --libsearpc_version="${LIBSEARPC_VERSION_FIXED}" \ + --seafile_version="${VERSION_SEAFILE}" \ + --version="${VERSION}" \ + --thirdpartdir="${THIRDPARTYFOLDER}" \ + --srcdir="${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}" \ + --mysql_config="${MYSQL_CONFIG_PATH}" \ + --outputdir="${SCRIPTPATH}/${PKGDIR}" \ + --yes) +fi +exitonfailure "Build Seafile server failed" + +msg "-> BUILD COMPLETED." diff --git a/compileScripts/compileSeafile_v10.0.1.sh b/compileScripts/compileSeafile_v10.0.1.sh new file mode 100755 index 0000000..6314313 --- /dev/null +++ b/compileScripts/compileSeafile_v10.0.1.sh @@ -0,0 +1,268 @@ +#!/bin/bash + +VERSION="10.0.1" +PATH=~/.cargo/bin:$PATH +cargo -V +LIBSEARPC_VERSION_LATEST="3.3-latest" # check if new tag is available on https://github.com/haiwen/libsearpc/releases +LIBSEARPC_VERSION_FIXED="3.1.0" # libsearpc sticks to 3.1.0 https://github.com/haiwen/libsearpc/commit/43d768cf2eea6afc6e324c2b1a37a69cd52740e3 + +SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" +#" +BUILDFOLDER="haiwen-build" +BUILDPATH="${SCRIPTPATH}/${BUILDFOLDER}" +THIRDPARTYFOLDER="${BUILDPATH}/seahub_thirdparty" +PKGSOURCEDIR="built-seafile-sources" +PKGDIR="built-seafile-server-pkgs" +PREFIX="${HOME}/opt/local" +# Temporary folder for seafile-server dependency builds for shared libraries (ld) +# see https://github.com/haiwen/seahub/blob/eab3ba2f6d3a311728130d8752c716e782b8d62e/scripts/build/build-server.py#L324 + +VERSION_SEAFILE="6.0.1" # dummy version for seafile (see configure.ac) +MYSQL_CONFIG_PATH="/usr/bin/mysql_config" # ensure compilation with mysql support + +VERSION_TAG="v${VERSION}-server" +LIBSEARPC_TAG="v${LIBSEARPC_VERSION_LATEST}" + +# colors used in functions for better readability +TXT_YELLOW="\033[93m" +TXT_DGRAY="\033[1;30m" +TXT_LGRAY="\033[0;37m" +TXT_LRED="\033[1;31m" +TXT_RED="\033[0;31m" +TXT_BLUE="\033[0;34m" +TXT_GREEN="\033[0;32m" +TXT_BOLD="\033[1m" +TXT_ITALIC="\033[3m" +TXT_UNDERSCORE="\033[4m" +# 48;5 for background, 38;5 for foreground +TXT_GREEN_ON_GREY="\033[48;5;240;38;5;040m" +TXT_ORANGE_ON_GREY="\033[48;5;240;38;5;202m" +OFF="\033[0m" + +msg() +{ + echo -e "\n${TXT_YELLOW}$1${OFF}\n" +} + +error() +{ + echo -e "${TXT_LRED}error:${OFF} $1"; + exit 1 +} + +alldone() +{ + echo -e " ${TXT_GREEN}done! ${OFF}" +} + +mkmissingdir() +{ + if [ ! -d "${1}" ]; then + echo -en "create missing directory ${TXT_BLUE}$1${OFF}..."; + mkdir -p "${1}" || error "failed!"; + alldone; + fi +} + +exitonfailure() +{ + if [ $? -ne 0 ]; then + error "$1" + fi +} + + + +############################################# + +mkmissingdir "${BUILDPATH}" + +msg "Build seafile-rpi ${VERSION_TAG}" + +msg "-> [] Prepare build" +mkmissingdir "${PREFIX}" +msg " Export LIBRARY_PATH, LD_LIBRARY_PATH, CPATH" +export LIBRARY_PATH="${PREFIX}/lib" +export LD_LIBRARY_PATH="${PREFIX}/lib" +export CPATH="${PREFIX}/include" +msg " LIBRARY_PATH = ${LIBRARY_PATH} " +msg " LD_LIBRARY_PATH = ${LD_LIBRARY_PATH} " +msg " CPATH = ${CPATH} " +#apt-get install python3-venv -y +#(set -x;python3 -m venv venv) +#source venv/bin/activate +(set -x; python3 -m pip install -U setuptools wheel pip) + +msg "-> [] Prepare libs" +# Export PKG_CONFIG_PATH for seafile-server and libsearpc +msg " Export PKG_CONFIG_PATH for seafile-server and libsearpc" +export PKG_CONFIG_PATH="${BUILDPATH}/libsearpc:${PKG_CONFIG_PATH}" +export PKG_CONFIG_PATH="${BUILDPATH}/seafile-server/lib:${PKG_CONFIG_PATH}" +msg " PKG_CONFIG_PATH = ${PKG_CONFIG_PATH} " + +msg "-> [] getting all git repos first" +cd "${BUILDPATH}" +(set -x; git clone "https://www.github.com/haiwen/libevhtp.git") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/libsearpc.git") +cd libsearpc +(set -x; git reset --hard "${LIBSEARPC_TAG}") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/seahub.git") +cd seahub +(set -x; git reset --hard "${VERSION_TAG}") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/seafile-server.git") +cd seafile-server +(set -x; git reset --hard "${VERSION_TAG}") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/seafobj.git") +cd seafobj +(set -x; git reset --hard "${VERSION_TAG}") +cd "${BUILDPATH}" +(set -x; git clone "https://github.com/haiwen/seafdav.git") +cd seafdav +(set -x; git reset --hard "${VERSION_TAG}") + +msg "-> [] Build libevhtp" +cd "${BUILDPATH}" +cd libevhtp +(set -x; cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .) +(set -x; make) +(set -x; make install) +exitonfailure "Build libevhtp failed" + +msg "-> [] Build libsearpc" +cd "${BUILDPATH}" +cd libsearpc +(set -x; ./autogen.sh) +(set -x; ./configure) +(set -x; make dist) +exitonfailure "Build libsearpc failed" + +msg "-> [] Build seahub" +cd "${BUILDPATH}" +cd seahub +msg " Export THIRDPARTYFOLDER to PATH" +export PATH="${THIRDPARTYFOLDER}:${PATH}" +msg " PATH = ${PATH}" +msg " Export THIRDPARTYFOLDER to PYTHONPATH" +export PYTHONPATH="${THIRDPARTYFOLDER}" +msg " PYTHONPATH = $PYTHONPATH${OFF}" +# to fix [ERROR] django-admin scripts not found in PATH +msg " export THIRDPARTYFOLDER/django/bin to PATH" +export PATH="${THIRDPARTYFOLDER}/django/bin:${PATH}" +msg " PATH = ${PATH}" +#fixing markupsafe to 2.0.1 +echo "markupsafe==2.0.1" >> "${BUILDPATH}/seafdav/requirements.txt" +#we do this for seafdav and seahub here once +(set -x; python3 -m pip install -r "${BUILDPATH}/seafdav/requirements.txt" -r "${BUILDPATH}/seahub/requirements.txt" --target "${THIRDPARTYFOLDER}" --no-cache --upgrade) +# generate package +# if python != python3.6 we need to "sudo ln -s /usr/bin/python3.6 /usr/bin/python" or with "pyenv global 3.6.9" +(set -x; python3 "${BUILDPATH}/seahub/tools/gen-tarball.py" --version="${VERSION_SEAFILE}" --branch=HEAD) +exitonfailure "Build seahub failed" + +msg "-> [] Build seafile-server (c_fileserver)" +cd "${BUILDPATH}" +cd seafile-server +(set -x; ./autogen.sh) +(set -x; ./configure --with-mysql=${MYSQL_CONFIG_PATH} --enable-ldap) +(set -x; make dist) +exitonfailure "Build seafile-server failed" + +msg "-> [] Build seafile-server (go_fileserver)" +cd "${BUILDPATH}" +cd seafile-server +(set -x; git reset --hard "${VERSION_TAG}") +(set -x; cd fileserver && CGO_ENABLED=0 go build .) +exitonfailure "Build seafile-server (go_fileserver) failed" + +msg "-> [] Build seafile-server (notification_server)" +cd "${BUILDPATH}" +cd seafile-server +(set -x; git reset --hard "${VERSION_TAG}") +(set -x; cd notification-server && CGO_ENABLED=0 go build .) +exitonfailure "Build seafile-server (notification_server) failed" + +msg "-> [] Build seafobj" +cd "${BUILDPATH}" +cd seafobj +(set -x; make dist) +exitonfailure "Build seafobj failed" + +msg "-> [] Build seafdav" +cd "${BUILDPATH}" +cd seafdav +(set -x; make) +exitonfailure "Build seafdav failed" + +msg "-> [] Copy sources to ${PKGSOURCEDIR}/R${VERSION} " +mkmissingdir "${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}" +for i in \ + "${BUILDPATH}/libsearpc/libsearpc-${LIBSEARPC_VERSION_FIXED}.tar.gz" \ + "${BUILDPATH}/seafile-server/seafile-${VERSION_SEAFILE}.tar.gz" \ + "${BUILDPATH}/seafile-server/fileserver/fileserver" \ + "${BUILDPATH}/seafile-server/notification-server/notification-server" \ + "${BUILDPATH}/seahub/seahub-${VERSION_SEAFILE}.tar.gz" \ + "${BUILDPATH}/seafobj/seafobj.tar.gz" \ + "${BUILDPATH}/seafdav/seafdav.tar.gz" +do + [ -f "$i" ] && (set -x; cp "$i" "${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}") +done + +msg "-> [${STEPCOUNTER}/${STEPS}] Build Seafile server" +cd "${BUILDPATH}" +mkmissingdir "${SCRIPTPATH}/${PKGDIR}" +# TODO: remove at seafile 10.0.2 release +msg "-> Patch build-server.py" +echo "--- build-server.py.old 2023-04-23 17:26:19.233328609 +0200 ++++ build-server.py 2023-04-23 17:22:58.625726460 +0200 +@@ -549,6 +549,15 @@ + + must_copy(src_go_fileserver, dst_bin_dir) + ++# copy notification_server "notification-server" to directory seafile-server/seafile/bin ++def copy_notification_server(): ++ builddir = conf[CONF_BUILDDIR] ++ srcdir = conf[CONF_SRCDIR] ++ src_notification_server = os.path.join(srcdir, 'notification-server') ++ dst_bin_dir = os.path.join(builddir, 'seafile-server', 'seafile', 'bin') ++ ++ must_copy(src_notification_server, dst_bin_dir) ++ + def copy_seafdav(): + dst_dir = os.path.join(conf[CONF_BUILDDIR], 'seafile-server', 'seahub', 'thirdpart') + tarball = os.path.join(conf[CONF_SRCDIR], 'seafdav.tar.gz') +@@ -578,6 +587,8 @@ + serverdir) + must_copy(os.path.join(scripts_srcdir, 'seafile.sh'), + serverdir) ++ must_copy(os.path.join(scripts_srcdir, 'seafile-monitor.sh'), ++ serverdir) + must_copy(os.path.join(scripts_srcdir, 'seahub.sh'), + serverdir) + must_copy(os.path.join(scripts_srcdir, 'reset-admin.sh'), +@@ -635,6 +646,9 @@ + # copy go_fileserver + copy_go_fileserver() + ++ # copy notification_server ++ copy_notification_server() ++ + def copy_pdf2htmlex(): + '''Copy pdf2htmlEX exectuable and its dependent libs''' + pdf2htmlEX_executable = find_in_path('pdf2htmlEX')" | patch -N -b -u "${BUILDPATH}/seahub/scripts/build/build-server.py" + +msg "-> Executing build-server.py" +(set -x; python3 "${BUILDPATH}/seahub/scripts/build/build-server.py" \ + --libsearpc_version="${LIBSEARPC_VERSION_FIXED}" \ + --seafile_version="${VERSION_SEAFILE}" \ + --version="${VERSION}" \ + --thirdpartdir="${THIRDPARTYFOLDER}" \ + --srcdir="${SCRIPTPATH}/${PKGSOURCEDIR}/R${VERSION}" \ + --mysql_config="${MYSQL_CONFIG_PATH}" \ + --outputdir="${SCRIPTPATH}/${PKGDIR}" \ + --yes) +exitonfailure "Build Seafile server failed" + +msg "-> BUILD COMPLETED." diff --git a/containerBuilders/BuildImageDockerFiles/bookworm_arm64 b/containerBuilders/BuildImageDockerFiles/bookworm_arm64 new file mode 100644 index 0000000..df33ef0 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/bookworm_arm64 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm64 debian:bookworm + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/bookworm_armv7 b/containerBuilders/BuildImageDockerFiles/bookworm_armv7 new file mode 100644 index 0000000..1caec21 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/bookworm_armv7 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm/v7 debian:bookworm + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/bullseye_arm64 b/containerBuilders/BuildImageDockerFiles/bullseye_arm64 new file mode 100644 index 0000000..bb30560 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/bullseye_arm64 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm64 debian:bullseye + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/bullseye_armv7 b/containerBuilders/BuildImageDockerFiles/bullseye_armv7 new file mode 100644 index 0000000..56d35b2 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/bullseye_armv7 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm/v7 debian:bullseye + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/buster_arm64 b/containerBuilders/BuildImageDockerFiles/buster_arm64 new file mode 100644 index 0000000..91c6940 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/buster_arm64 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm64 debian:buster + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/buster_armv7 b/containerBuilders/BuildImageDockerFiles/buster_armv7 new file mode 100644 index 0000000..d96835e --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/buster_armv7 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm/v7 debian:buster + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/focal_arm64 b/containerBuilders/BuildImageDockerFiles/focal_arm64 new file mode 100644 index 0000000..ef13c65 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/focal_arm64 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm64 ubuntu:focal + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/focal_armv7 b/containerBuilders/BuildImageDockerFiles/focal_armv7 new file mode 100644 index 0000000..9ecc785 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/focal_armv7 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm/v7 ubuntu:focal + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/jammy_arm64 b/containerBuilders/BuildImageDockerFiles/jammy_arm64 new file mode 100644 index 0000000..257b193 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/jammy_arm64 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm64 ubuntu:jammy + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/BuildImageDockerFiles/jammy_armv7 b/containerBuilders/BuildImageDockerFiles/jammy_armv7 new file mode 100644 index 0000000..3f6dca2 --- /dev/null +++ b/containerBuilders/BuildImageDockerFiles/jammy_armv7 @@ -0,0 +1,46 @@ +FROM --platform=linux/arm/v7 ubuntu:jammy + + +RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y \ + tzdata \ + wget \ + curl \ + libc6-dev \ + libmemcached-dev \ + build-essential \ + cmake \ + git \ + intltool \ + libarchive-dev \ + libcurl4-openssl-dev \ + libevent-dev \ + libffi-dev \ + libfuse-dev \ + libglib2.0-dev \ + libjansson-dev \ + libjpeg-dev \ + libjwt-dev \ + libldap2-dev \ + libmariadbclient-dev-compat \ + libonig-dev \ + libpq-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libxml2-dev \ + libxslt-dev \ + python3-distro \ + python3-lxml \ + python3-ldap \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + uuid-dev \ + valac + +ARG GOVERSION +RUN curl --proto '=https' --tlsv1.2 -sSfk https://sh.rustup.rs > /tmp/rust_install.sh;chmod 755 /tmp/rust_install.sh;/tmp/rust_install.sh -y +RUN wget --no-check-certificate https://go.dev/dl/$GOVERSION +RUN tar -xzf $GOVERSION +RUN mv go /usr/local +RUN ln -s /usr/local/go/bin/go /usr/bin/go diff --git a/containerBuilders/TestingImageDockerFiles/bookworm_arm64 b/containerBuilders/TestingImageDockerFiles/bookworm_arm64 new file mode 100644 index 0000000..5a85a25 --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/bookworm_arm64 @@ -0,0 +1 @@ +FROM --platform=linux/arm64 debian:bookworm diff --git a/containerBuilders/TestingImageDockerFiles/bookworm_armv7 b/containerBuilders/TestingImageDockerFiles/bookworm_armv7 new file mode 100644 index 0000000..feab040 --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/bookworm_armv7 @@ -0,0 +1 @@ +FROM --platform=linux/arm/v7 debian:bookworm diff --git a/containerBuilders/TestingImageDockerFiles/bullseye_arm64 b/containerBuilders/TestingImageDockerFiles/bullseye_arm64 new file mode 100644 index 0000000..6e3b39c --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/bullseye_arm64 @@ -0,0 +1 @@ +FROM --platform=linux/arm64 debian:bullseye diff --git a/containerBuilders/TestingImageDockerFiles/bullseye_armv7 b/containerBuilders/TestingImageDockerFiles/bullseye_armv7 new file mode 100644 index 0000000..f989866 --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/bullseye_armv7 @@ -0,0 +1 @@ +FROM --platform=linux/arm/v7 debian:bullseye diff --git a/containerBuilders/TestingImageDockerFiles/buster_arm64 b/containerBuilders/TestingImageDockerFiles/buster_arm64 new file mode 100644 index 0000000..a8d67c5 --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/buster_arm64 @@ -0,0 +1 @@ +FROM --platform=linux/arm64 debian:buster diff --git a/containerBuilders/TestingImageDockerFiles/buster_armv7 b/containerBuilders/TestingImageDockerFiles/buster_armv7 new file mode 100644 index 0000000..3ca465c --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/buster_armv7 @@ -0,0 +1 @@ +FROM --platform=linux/arm/v7 debian:buster diff --git a/containerBuilders/TestingImageDockerFiles/focal_arm64 b/containerBuilders/TestingImageDockerFiles/focal_arm64 new file mode 100644 index 0000000..ea71698 --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/focal_arm64 @@ -0,0 +1 @@ +FROM --platform=linux/arm64 ubuntu:focal diff --git a/containerBuilders/TestingImageDockerFiles/focal_armv7 b/containerBuilders/TestingImageDockerFiles/focal_armv7 new file mode 100644 index 0000000..cc34bea --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/focal_armv7 @@ -0,0 +1 @@ +FROM --platform=linux/arm/v7 ubuntu:focal diff --git a/containerBuilders/TestingImageDockerFiles/jammy_arm64 b/containerBuilders/TestingImageDockerFiles/jammy_arm64 new file mode 100644 index 0000000..b3beb05 --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/jammy_arm64 @@ -0,0 +1 @@ +FROM --platform=linux/arm64 ubuntu:jammy diff --git a/containerBuilders/TestingImageDockerFiles/jammy_armv7 b/containerBuilders/TestingImageDockerFiles/jammy_armv7 new file mode 100644 index 0000000..ecd9d7c --- /dev/null +++ b/containerBuilders/TestingImageDockerFiles/jammy_armv7 @@ -0,0 +1 @@ +FROM --platform=linux/arm/v7 ubuntu:jammy diff --git a/containerBuilders/createBuildImage.sh b/containerBuilders/createBuildImage.sh new file mode 100755 index 0000000..95db002 --- /dev/null +++ b/containerBuilders/createBuildImage.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +#script parameters: +# createBuildImage.sh [distribution] [architecture] [GOpackage] +#e.g. +# createBuildImage.sh bookworm arm64 go1.20.4.linux-arm64.tar.gz +# createBuildImage.sh focal arm/v7 go1.20.4.linux-armv6l.tar.gz +# + +cd $(dirname $0) +# Register/update emulators +docker run --rm --privileged tonistiigi/binfmt --install all >/dev/null + +builder=multiarch_builder +# create multiarch builder if needed +if [ "$(docker buildx ls | grep $builder)" == "" ] +then + docker buildx create --name $builder +fi +docker buildx use $builder + +# Build image +docker buildx build -f "BuildImageDockerFiles/${1}_${2//\/}" --load --platform "linux/${2}" --build-arg GOVERSION=${3} -t "seafile-builder:${1}" -t "seafile-builder:latest" "." diff --git a/containerBuilders/createTestingImage.sh b/containerBuilders/createTestingImage.sh new file mode 100755 index 0000000..ad8baa9 --- /dev/null +++ b/containerBuilders/createTestingImage.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +#script parameters: +# createTestingImage.sh [distribution] [architecture] +#e.g. +# createTestingImage.sh bookworm arm64 +# createTestingImage.sh focal arm/v7 +# + +cd $(dirname $0) +# Register/update emulators +docker run --rm --privileged tonistiigi/binfmt --install all >/dev/null + +builder=multiarch_builder +# create multiarch builder if needed +if [ "$(docker buildx ls | grep $builder)" == "" ] +then + docker buildx create --name $builder +fi +docker buildx use $builder + +# Build image +docker buildx build -f "TestingImageDockerFiles/${1}_${2//\/}" --load --platform "linux/${2}" -t "seafile-testing:${1}" -t "seafile-testing:latest" "." diff --git a/githubActionsHelper/prepareHost.sh b/githubActionsHelper/prepareHost.sh new file mode 100755 index 0000000..f472515 --- /dev/null +++ b/githubActionsHelper/prepareHost.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +#this script prepares the build host in github to have docker up and running +#being able to build multiarch +#it is exectuted from within the github actions pipeline + +sudo apt-get install ca-certificates curl gnupg -y +sudo install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +sudo chmod a+r /etc/apt/keyrings/docker.gpg +echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y diff --git a/maintain.md b/maintain.md deleted file mode 100644 index 8f85314..0000000 --- a/maintain.md +++ /dev/null @@ -1,32 +0,0 @@ -# Build - -``` -$ sudo ./build.sh -``` - -Please check [the official document](http://manual.seafile.com/build_seafile/rpi.html) - -# Release a new version - -- Make sure the package has been tested -- Create a new release on https://github.com/haiwen/seafile-rpi/releases/new -- Release title should be like "Seafile server 4.1.2 for Raspberry Pi" -- Upload the packages there. -- After uploading, update the version number and download link in [REAME.md](README.md). - -# Common problems and solutions - -## Not enough memory to build lxml package - -symptoms: -``` -Processing lxml-4.4.1.tar.gz -aarch64-linux-gnu-gcc: internal compiler error: Killed (program cc1) -``` - -solution: Increase available memory by using a [swap file](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-18-04) - -## Unknown seahub error while gunicorn starting - -symptoms: fails with no console message -solution: temporary comment 'Daemon=True' line in gunicorn.conf and start seahub again diff --git a/manualBuildAndTest/buildAllArm64.sh b/manualBuildAndTest/buildAllArm64.sh new file mode 100755 index 0000000..b418aea --- /dev/null +++ b/manualBuildAndTest/buildAllArm64.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +#this script builds all arm64 packages for all distributions that are currently supported + +export VERSION=10.0.1 + +cd $(dirname $0) + +./dockerReset.sh +../containerBuilders/createBuildImage.sh buster arm64 go1.20.4.linux-arm64.tar.gz +../compileScripts/buildServerPackage.sh buster arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createBuildImage.sh bullseye arm64 go1.20.4.linux-arm64.tar.gz +../compileScripts/buildServerPackage.sh bullseye arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createBuildImage.sh bookworm arm64 go1.20.4.linux-arm64.tar.gz +../compileScripts/buildServerPackage.sh bookworm arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createBuildImage.sh focal arm64 go1.20.4.linux-arm64.tar.gz +../compileScripts/buildServerPackage.sh focal arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createBuildImage.sh jammy arm64 go1.20.4.linux-arm64.tar.gz +../compileScripts/buildServerPackage.sh jammy arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh diff --git a/manualBuildAndTest/buildAllArmv7.sh b/manualBuildAndTest/buildAllArmv7.sh new file mode 100755 index 0000000..e610ec1 --- /dev/null +++ b/manualBuildAndTest/buildAllArmv7.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +#this script builds all arm/v7 packages for all distributions that are currently supported + +export VERSION=10.0.1 + +cd $(dirname $0) + +./dockerReset.sh +../containerBuilders/createBuildImage.sh buster arm/v7 go1.20.4.linux-armv6l.tar.gz +../compileScripts/buildServerPackage.sh buster arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createBuildImage.sh bullseye arm/v7 go1.20.4.linux-armv6l.tar.gz +../compileScripts/buildServerPackage.sh bullseye arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createBuildImage.sh bookworm arm/v7 go1.20.4.linux-armv6l.tar.gz +../compileScripts/buildServerPackage.sh bookworm arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createBuildImage.sh focal arm/v7 go1.20.4.linux-armv6l.tar.gz +../compileScripts/buildServerPackage.sh focal arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createBuildImage.sh jammy arm/v7 go1.20.4.linux-armv6l.tar.gz +../compileScripts/buildServerPackage.sh jammy arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error when building" + exit 1 +fi + +./dockerReset.sh diff --git a/manualBuildAndTest/dockerReset.sh b/manualBuildAndTest/dockerReset.sh new file mode 100755 index 0000000..3872291 --- /dev/null +++ b/manualBuildAndTest/dockerReset.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +#this script deletes all build containers, running containers and volumes +#this includes also the volumes that might not be related to build containers +#so be carefull it is meant to clean up and reclaim space + +docker kill $(docker container ls -q) >> /dev/null 2>&1 +docker builder rm multiarch_builder +docker container prune -f +docker builder prune -a -f +docker system prune -a -f +docker volume prune -a -f + diff --git a/manualBuildAndTest/testAllArm64.sh b/manualBuildAndTest/testAllArm64.sh new file mode 100755 index 0000000..d379660 --- /dev/null +++ b/manualBuildAndTest/testAllArm64.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +#this script tests all arm64 packages for all distributions that are currently supported + +cd $(dirname $0) + +./dockerReset.sh +../containerBuilders/createTestingImage.sh buster arm64 +../testScripts/startServerPackageTest.sh buster arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createTestingImage.sh bullseye arm64 +../testScripts/startServerPackageTest.sh bullseye arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createTestingImage.sh bookworm arm64 +../testScripts/startServerPackageTest.sh bookworm arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createTestingImage.sh focal arm64 +../testScripts/startServerPackageTest.sh focal arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createTestingImage.sh jammy arm64 +../testScripts/startServerPackageTest.sh jammy arm64 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh diff --git a/manualBuildAndTest/testAllArmv7.sh b/manualBuildAndTest/testAllArmv7.sh new file mode 100755 index 0000000..4d04515 --- /dev/null +++ b/manualBuildAndTest/testAllArmv7.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +#this script tests all arm/v7 packages for all distributions that are currently supported + +cd $(dirname $0) + +./dockerReset.sh +../containerBuilders/createTestingImage.sh buster arm/v7 +../testScripts/startServerPackageTest.sh buster arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createTestingImage.sh bullseye arm/v7 +../testScripts/startServerPackageTest.sh bullseye arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createTestingImage.sh bookworm arm/v7 +../testScripts/startServerPackageTest.sh bookworm arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createTestingImage.sh focal arm/v7 +../testScripts/startServerPackageTest.sh focal arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh +../containerBuilders/createTestingImage.sh jammy arm/v7 +../testScripts/startServerPackageTest.sh jammy arm/v7 +RESULT=$? +if [ $RESULT -ne 0 ]; then + echo "Error while test" + exit 1 +fi + +./dockerReset.sh diff --git a/requirements/README.md b/requirements/README.md deleted file mode 100644 index 4401846..0000000 --- a/requirements/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Requirements - -Updated dependencies for [Seahub](https://github.com/haiwen/seahub/blob/master/requirements.txt) -and [Seafdav](https://github.com/haiwen/seafdav/blob/master/requirements.txt). diff --git a/requirements/seafdav_requirements_v10.0.1.txt b/requirements/seafdav_requirements_v10.0.1.txt deleted file mode 100644 index 249a9d8..0000000 --- a/requirements/seafdav_requirements_v10.0.1.txt +++ /dev/null @@ -1,10 +0,0 @@ -defusedxml~=0.5 -Jinja2~=2.10 -json5~=0.8.5 -python-pam~=1.8 -PyYAML~=5.1 -six~=1.13 -lxml -sqlalchemy -# input from @wsirhc see https://github.com/haiwen/seafile-rpi/issues/113 -markupsafe==2.0.1 diff --git a/requirements/seafdav_requirements_v9.0.5.txt b/requirements/seafdav_requirements_v9.0.5.txt deleted file mode 100644 index 249a9d8..0000000 --- a/requirements/seafdav_requirements_v9.0.5.txt +++ /dev/null @@ -1,10 +0,0 @@ -defusedxml~=0.5 -Jinja2~=2.10 -json5~=0.8.5 -python-pam~=1.8 -PyYAML~=5.1 -six~=1.13 -lxml -sqlalchemy -# input from @wsirhc see https://github.com/haiwen/seafile-rpi/issues/113 -markupsafe==2.0.1 diff --git a/requirements/seafdav_requirements_v9.0.9.txt b/requirements/seafdav_requirements_v9.0.9.txt deleted file mode 100644 index 249a9d8..0000000 --- a/requirements/seafdav_requirements_v9.0.9.txt +++ /dev/null @@ -1,10 +0,0 @@ -defusedxml~=0.5 -Jinja2~=2.10 -json5~=0.8.5 -python-pam~=1.8 -PyYAML~=5.1 -six~=1.13 -lxml -sqlalchemy -# input from @wsirhc see https://github.com/haiwen/seafile-rpi/issues/113 -markupsafe==2.0.1 diff --git a/requirements/seahub_requirements_v10.0.1.txt b/requirements/seahub_requirements_v10.0.1.txt deleted file mode 100644 index e691b5e..0000000 --- a/requirements/seahub_requirements_v10.0.1.txt +++ /dev/null @@ -1,28 +0,0 @@ -Django==3.2.16 -django-statici18n==2.3.* -django_webpack_loader==1.7.* -django_picklefield==3.1 -django_formtools==2.4 -django_simple_captcha==0.5.* -djangosaml2==1.5.* -djangorestframework==3.14.* -python-dateutil==2.8.* -pyjwt==2.6.* -pycryptodome==3.16.* -python-cas==1.6.* -pysaml2==7.2.* -requests==2.28.* -requests_oauthlib==1.3.* -future==0.18.* -gunicorn==20.1.* -mysqlclient==2.1.* -qrcode==7.3.* -pillow==9.3.* -chardet==5.1.* -cffi==1.15.1 -captcha==0.4 -openpyxl==3.0.* -Markdown==3.4.* -bleach==5.0.* -# input from @nihilistaX see https://github.com/haiwen/seafile-rpi/issues/99 -cryptography~=36.0.0 diff --git a/requirements/seahub_requirements_v9.0.5.txt b/requirements/seahub_requirements_v9.0.5.txt deleted file mode 100644 index bdf61bc..0000000 --- a/requirements/seahub_requirements_v9.0.5.txt +++ /dev/null @@ -1,27 +0,0 @@ -# See: https://github.com/haiwen/seafile-rpi/issues/99#issuecomment-1002535579 -Django<4 -future -captcha -django-statici18n -django-webpack_loader==0.7.0 -gunicorn -mysqlclient -django-picklefield>=2.1.1 -openpyxl -qrcode -django-formtools>=2.3 -django-simple-captcha -djangorestframework>=3.11.1 -python-dateutil -requests -pillow -pyjwt>=2.1.* -pycryptodome>=3.12.0 -requests_oauthlib -chardet -python-cas -djangosaml2>=0.20.0 -pysaml2>=6.5.1 -cffi>=1.14.0 -# input from @nihilistaX see https://github.com/haiwen/seafile-rpi/issues/99 -cryptography==36.0.0 diff --git a/requirements/seahub_requirements_v9.0.9.txt b/requirements/seahub_requirements_v9.0.9.txt deleted file mode 100644 index 958cd37..0000000 --- a/requirements/seahub_requirements_v9.0.9.txt +++ /dev/null @@ -1,29 +0,0 @@ -# See: https://github.com/haiwen/seafile-rpi/issues/99#issuecomment-1002535579 -Django<4 -future -captcha -django-statici18n -django-webpack_loader~=0.7.0 -gunicorn -mysqlclient -django-picklefield>=2.1.1 -openpyxl -qrcode -django-formtools>=2.3 -django-simple-captcha -djangorestframework>=3.11.1 -python-dateutil -requests -pillow -pyjwt>=2.1.0 -pycryptodome>=3.12.0 -requests-oauthlib -chardet -python-cas -djangosaml2>=0.20.0 -pysaml2>=6.5.1 -cffi>=1.14.0 -# input from @nihilistaX see https://github.com/haiwen/seafile-rpi/issues/99 -cryptography~=36.0.0 -Markdown -bleach diff --git a/testScripts/runTest_default.sh b/testScripts/runTest_default.sh new file mode 100755 index 0000000..4b26cb2 --- /dev/null +++ b/testScripts/runTest_default.sh @@ -0,0 +1,134 @@ +#!/bin/bash + +SEAFILE_ADMIN=test\@test.com +SEAFILE_ADMIN_PW=test +PACKAGE=$(find /PACKAGE_DIR -type f -iname "*.tar.gz") +echo -e "Using server package: $PACKAGE\n" + +apt-get update && apt-get install python3 sqlite3 net-tools procps wget -y +if [[ "$PACKAGE" =~ buster ]]; then + apt-get install libjpeg62-turbo -y +fi +if [[ "$PACKAGE" =~ bullseye ]]; then + apt-get install libjpeg62-turbo -y +fi +if [[ "$PACKAGE" =~ bookworm ]]; then + apt-get install libjpeg62-turbo -y +fi +if [[ "$PACKAGE" =~ focal ]]; then + apt-get install libjpeg8 -y +fi +if [[ "$PACKAGE" =~ jammy ]]; then + apt-get install libjpeg8 -y +fi +cd /opt +tar -xzf $PACKAGE +cd /opt/$(ls -1 /opt) + +./setup-seafile.sh auto -n test -i 0.0.0.0 +#enable seafdav for testing +sed -i 's/enabled = false/enabled = true/' ../conf/seafdav.conf +./seafile.sh start +sleep 30 + +netstat -ltepn|grep :8082 +if [ $? -ne 0 ]; then + echo "ERROR seafile did not start" + ps axfu + exit 1 +fi +netstat -ltepn|grep :8080 +if [ $? -ne 0 ]; then + echo "ERROR seafdav did not start" + ps axfu + exit 1 +fi + +sed -i 's/= ask_admin_email()/= \"${SEAFILE_ADMIN}\"/' check_init_admin.py +sed -i 's/= ask_admin_password()/= \"${SEAFILE_ADMIN_PW}\"/' check_init_admin.py +./seahub.sh start +sleep 10 + +netstat -ltepn|grep :8000 +if [ $? -ne 0 ]; then + echo "ERROR seahub did not start" + ps axfu + exit 1 +fi +wget http://127.0.0.1:8000 -q -O - | grep login > /dev/null +if [ $? -ne 0 ]; then + echo "ERROR seahub did not respond" + exit 1 +fi + +./seahub.sh stop +./seafile.sh stop +sleep 1 +cd /opt +rm -rf /opt/* + + +apt-get install mariadb-server python3-pip -y +if [[ "$PACKAGE" =~ focal ]]; then + apt-get install libmariadb3 -y +fi +if [[ "$PACKAGE" =~ jammy ]]; then + apt-get install libmariadb3 -y +fi +service mariadb start +service mysql start +sleep 1 +netstat -ltepn|grep :3306 +if [ $? -ne 0 ]; then + echo "ERROR mariadb did not start" + ps axfu + exit 1 +fi +mysqladmin -u root password test + +if [[ "$PACKAGE" =~ bookworm ]]; then + python3 -m pip install pymysql --break-system-packages +else + python3 -m pip install pymysql +fi +tar -xzf $PACKAGE +cd /opt/$(ls -1 /opt) + +./setup-seafile-mysql.sh auto -n test -i 0.0.0.0 -u seafile -w test -r test +#enable seafdav for testing +sed -i 's/enabled = false/enabled = true/' ../conf/seafdav.conf +./seafile.sh start +sleep 30 + +netstat -ltepn|grep :8082 +if [ $? -ne 0 ]; then + echo "ERROR seafile did not start" + ps axfu + exit 1 +fi +netstat -ltepn|grep :8080 +if [ $? -ne 0 ]; then + echo "ERROR seafdav did not start" + ps axfu + exit 1 +fi + +sed -i 's/= ask_admin_email()/= \"${SEAFILE_ADMIN}\"/' check_init_admin.py +sed -i 's/= ask_admin_password()/= \"${SEAFILE_ADMIN_PW}\"/' check_init_admin.py +./seahub.sh start +sleep 10 + +netstat -ltepn|grep :8000 +if [ $? -ne 0 ]; then + echo "ERROR seahub did not start" + ps axfu + exit 1 +fi +wget http://127.0.0.1:8000 -q -O - | grep login > /dev/null +if [ $? -ne 0 ]; then + echo "ERROR seahub did not respond" + exit 1 +fi + +echo "All tests ok" +exit 0 diff --git a/testScripts/startServerPackageTest.sh b/testScripts/startServerPackageTest.sh new file mode 100755 index 0000000..505dde3 --- /dev/null +++ b/testScripts/startServerPackageTest.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +#this script starts the prepared test container and tests the server package +#script parameters: +# startServerPackageTest.sh [distribution] [architecture] +#e.g. +# startServerPackageTest.sh buster arm64 +# startServerPackageTest.sh focal arm/v7 +# +# the compiled server package is expected to be in the directory ../out, which is the case +# if the compile scripts of this repo were used + +cd $(dirname $0) +MY_DIR=$(pwd) +PACKAGE_DIR="../out" +cd $PACKAGE_DIR +PACKAGE_DIR=$(pwd) +cd $MY_DIR + +if [ -f "./runTest_v${VERSION}.sh" ];then + cmd="/runTest.sh" + USESCRIPT="v${VERSION}" +else + cmd="/runTest.sh ${VERSION}" + USESCRIPT="default" +fi + + +SERVER_PACKAGE=$(find $PACKAGE_DIR/$2 -type f -iname "*.tar.gz" 2>/dev/null | grep $1 2>/dev/null) +SERVER_PACKAGE_FILENAME=$(basename $SERVER_PACKAGE) + +docker run --rm \ + --platform linux/${2} \ + --pull missing \ + -v "./runTest_${USESCRIPT}.sh":/runTest.sh \ + --mount type=bind,src="$SERVER_PACKAGE",dst="/PACKAGE_DIR/$SERVER_PACKAGE_FILENAME" \ + seafile-testing:${1} /bin/bash -c "$cmd"