Browse Source

Merge pull request #889 from gravitl/worklows

Add packages (deb, rpm, pacman) to build and release workflow
dcarns 3 years ago
parent
commit
5ffa53f5de
6 changed files with 265 additions and 34 deletions
  1. 8 0
      .fpm
  2. 235 29
      .github/workflows/buildandrelease.yml
  3. 5 4
      .github/workflows/purgeGHCR.yml
  4. 1 0
      .gitignore
  5. 1 1
      logic/peers.go
  6. 15 0
      netclient/build/netclient.service

+ 8 - 0
.fpm

@@ -0,0 +1,8 @@
+--name netclient 
+--license sspl 
+--depends wireguard-tools 
+--description "Netmaker's netclient agent and CLI" 
+--url "https//:github.com/gravitl/netmaker" 
+--maintainer "[email protected]" 
+--vendor Gravitl
+

+ 235 - 29
.github/workflows/buildandrelease.yml

@@ -5,16 +5,17 @@ on:
     inputs:
     inputs:
       version:
       version:
         description: 'Netmaker version'
         description: 'Netmaker version'
-        required: false
+        required: true
   release:
   release:
     types: [published]
     types: [published]
 
 
 jobs:
 jobs:
-  build:
+  version:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
-
+    outputs:
+      tag: ${{ steps.echo.outputs.tag }}
+      version: ${{ steps.echo.outputs.version }}
     steps:
     steps:
-
       - name: Get Version Number
       - name: Get Version Number
         run: |
         run: |
           if [[ -n "${{ github.event.inputs.version }}" ]]; then
           if [[ -n "${{ github.event.inputs.version }}" ]]; then
@@ -23,32 +24,43 @@ jobs:
             NETMAKER_VERSION=$(curl -fsSL https://api.github.com/repos/gravitl/netmaker/tags | grep 'name' | head -1 | cut -d'"' -f4)
             NETMAKER_VERSION=$(curl -fsSL https://api.github.com/repos/gravitl/netmaker/tags | grep 'name' | head -1 | cut -d'"' -f4)
           fi
           fi
           echo "NETMAKER_VERSION=${NETMAKER_VERSION}" >> $GITHUB_ENV
           echo "NETMAKER_VERSION=${NETMAKER_VERSION}" >> $GITHUB_ENV
+          # remove everything but digits and . for package (deb, rpm, etc) versions
+          PACKAGE_VERSION=$(echo ${NETMAKER_VERSION} | tr -cd '[:digit:].')
+          echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
+      - name: Echo
+        id: echo
+        run: |
+          echo ${{ env.NETMAKER_VERSION }}
+          echo ${{ env.PACKAGE_VERSION }}
+          if [[ -z ${{ env.NETMAKER_VERSION }} || -z ${{ env.PACKAGE_VERSION }} ]]
+          then
+            exit 1
+          fi
+          echo "::set-output name=tag::${{ env.NETMAKER_VERSION }}"
+          echo "::set-output name=version::${{ env.PACKAGE_VERSION }}"
+  netmaker:        
+    runs-on: ubuntu-latest
+    needs: version
+    steps:
+      - name: set variables
+        run: |
+          echo ${{ needs.version.outputs.tag }} ${{ needs.version.outputs.version }}
+          TAG=${{needs.version.outputs.tag}}
+          VERSION=${{needs.version.outputs.version}}
+          if [[ -z ${VERSION} || -z ${TAG} ]]; then
+            exit 1
+          fi
+          echo "NETMAKER_VERSION=${TAG}"  >> $GITHUB_ENV
+          echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
       - name: Checkout
       - name: Checkout
         uses: actions/checkout@v2
         uses: actions/checkout@v2
-
       - name: Setup go
       - name: Setup go
         uses: actions/setup-go@v2
         uses: actions/setup-go@v2
         with:
         with:
           go-version: 1.17
           go-version: 1.17
-
       - name: Build
       - name: Build
         run: |
         run: |
           env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netmaker main.go
           env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netmaker main.go
-          cd netclient
-          env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient main.go
-          env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm5/netclient main.go
-          env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm6/netclient main.go
-          env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm7/netclient main.go
-          env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm64/netclient main.go
-          env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'main.version=$NETMAKER_VERSION'" -o build/netclient-mipsle/netclient main.go && upx build/netclient-mipsle/netclient
-          env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'main.Version=${NETMAKER_VERSION}'" -o build/netclient-freebsd/netclient main.go
-          env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm5/netclient main.go
-          env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm6/netclient main.go
-          env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm7/netclient main.go
-          env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm64/netclient main.go
-          env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-darwin/netclient main.go
-          env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-darwin-arm64/netclient main.go
-          
       - name: Upload netmaker x86 to Release
       - name: Upload netmaker x86 to Release
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
         with:
         with:
@@ -59,7 +71,28 @@ jobs:
           prerelease: true
           prerelease: true
           asset_name: netmaker
           asset_name: netmaker
 
 
-      - name: Upload x86 to Release
+  netclient-x86:
+    runs-on: ubuntu-latest
+    needs: version
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set Variables
+        run: |
+          TAG=${{needs.version.outputs.tag}}
+          VERSION=${{needs.version.outputs.version}}
+          echo "NETMAKER_VERSION=${TAG}"  >> $GITHUB_ENV
+          echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
+      - name: Setup go
+        uses: actions/setup-go@v2
+        with:
+          go-version: 1.17
+      - name: Build
+        run: |
+          cd netclient
+          env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient main.go
+      - name: Upload netclient x86 to Release
+        continue-on-error: true
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
         with:
         with:
           repo_token: ${{ secrets.GITHUB_TOKEN }}
           repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -69,26 +102,100 @@ jobs:
           prerelease: true
           prerelease: true
           asset_name: netclient
           asset_name: netclient
 
 
-      - name: Upload arm5 to Release
+      - name: Package x86 deb
+        continue-on-error: true
+        uses: gravitl/github-action-fpm@master
+        with:
+          fpm_args: './netclient/build/netclient=/sbin/netclient ./netclient/build/netclient.service=/lib/systemd/system/netclient.service'
+          fpm_opts: '-s dir -t deb --architecture amd64 --version ${{ env.PACKAGE_VERSION }}'
+      - name: Upload x86 deb to Release
+        continue-on-error: true
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
         with:
         with:
           repo_token: ${{ secrets.GITHUB_TOKEN }}
           repo_token: ${{ secrets.GITHUB_TOKEN }}
-          file: netclient/build/netclient-arm5/netclient
+          file: netclient_${{ env.PACKAGE_VERSION }}_amd64.deb
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: netclient_${{ env.PACKAGE_VERSION }}_amd64.deb
+
+      - name: Package x86 rpm
+        continue-on-error: true
+        uses: gravitl/github-action-fpm@master
+        with:
+          fpm_args: './netclient/build/netclient=/sbin/netclient ./netclient/build/netclient.service=/lib/systemd/system/netclient.service'
+          fpm_opts: '-s dir -t rpm --architecture amd64 --version ${{ env.PACKAGE_VERSION }}'
+      - name: Upload x86 rpm to Release
+        continue-on-error: true
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: netclient-${{ env.PACKAGE_VERSION }}-1.x86_64.rpm 
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: netclient-${{ env.PACKAGE_VERSION }}-1.x86_64.rpm
+
+      - name: Package x86 pacman
+        continue-on-error: true
+        uses: gravitl/github-action-fpm@master
+        with:
+          # arch has particular path requirements --- cannot write to a symbolic link e.g. /sbin and /lib
+          fpm_args: './netclient/build/netclient=/usr/bin/netclient ./netclient/build/netclient.service=/usr/lib/systemd/system/netclient.service'
+          fpm_opts: '-s dir -t pacman --architecture amd64 --version ${{ env.PACKAGE_VERSION }}'
+      - name: Upload x86 pacman to Release
+        continue-on-error: true
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: netclient-${{ env.PACKAGE_VERSION }}-1-x86_64.pkg.tar.zst
           tag: ${{ env.NETMAKER_VERSION }}
           tag: ${{ env.NETMAKER_VERSION }}
           overwrite: true
           overwrite: true
           prerelease: true
           prerelease: true
+          asset_name: netclient-${{ env.PACKAGE_VERSION }}-1-x86_64.pkg.tar.zst
+
+  netclient-arm:
+    runs-on: ubuntu-latest
+    needs: version
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set Variables
+        run: |
+          TAG=${{needs.version.outputs.tag}}
+          VERSION=${{needs.version.outputs.version}}
+          echo "NETMAKER_VERSION=${TAG}"  >> $GITHUB_ENV
+          echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
+      - name: Setup go
+        uses: actions/setup-go@v2
+        with:
+          go-version: 1.17
+      - name: Build
+        run: |
+          cd netclient
+          env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm5/netclient main.go
+          env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm6/netclient main.go
+          env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm7/netclient main.go
+          env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm64/netclient main.go
+      - name: Upload arm5 to Release
+        uses: svenstaro/upload-release-action@v2
+        with: 
+          repo_token: ${{ secrets.GITHUB_TOKEN }} 
+          file: netclient/build/netclient-arm5/netclient
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true 
+          prerelease: true
           asset_name: netclient-arm5
           asset_name: netclient-arm5
 
 
       - name: Upload arm6 to Release
       - name: Upload arm6 to Release
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
-        with:
+        with: 
           repo_token: ${{ secrets.GITHUB_TOKEN }}
           repo_token: ${{ secrets.GITHUB_TOKEN }}
           file: netclient/build/netclient-arm6/netclient
           file: netclient/build/netclient-arm6/netclient
           tag: ${{ env.NETMAKER_VERSION }}
           tag: ${{ env.NETMAKER_VERSION }}
           overwrite: true
           overwrite: true
           prerelease: true
           prerelease: true
           asset_name: netclient-arm6
           asset_name: netclient-arm6
-
       - name: Upload arm7 to Release
       - name: Upload arm7 to Release
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
         with:
         with:
@@ -98,8 +205,9 @@ jobs:
           overwrite: true
           overwrite: true
           prerelease: true
           prerelease: true
           asset_name: netclient-arm7
           asset_name: netclient-arm7
-
+     
       - name: Upload arm64 to Release
       - name: Upload arm64 to Release
+        continue-on-error: true
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
         with:
         with:
           repo_token: ${{ secrets.GITHUB_TOKEN }}
           repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -108,7 +216,59 @@ jobs:
           overwrite: true
           overwrite: true
           prerelease: true
           prerelease: true
           asset_name: netclient-arm64
           asset_name: netclient-arm64
+      - name: Package arm64 deb
+        continue-on-error: true
+        uses: gravitl/github-action-fpm@master
+        with:
+          fpm_args: './netclient/build/netclient-arm64/netclient=/sbin/netclient ./netclient/build/netclient.service=/lib/systemd/netclient.service'
+          fpm_opts: '-s dir -t deb --architecture arm64 --version ${{ env.PACKAGE_VERSION }}'
+      - name: Upload arm deb to Release
+        continue-on-error: true
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: netclient_${{ env.PACKAGE_VERSION }}_arm64.deb
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: netclient_${{ env.PACKAGE_VERSION }}_arm64.deb
+      - name: Package arm64 rpm
+        continue-on-error: true
+        uses: gravitl/github-action-fpm@master
+        with:
+          fpm_args: './netclient/build/netclient-arm64/netclient=/sbin/netclient ./netclient/build/netclient.service=/lib/systemd/netclient.service'
+          fpm_opts: '-s dir -t rpm --architecture arm64 --version ${{ env.PACKAGE_VERSION }}'
+      - name: Upload arm64 rpm to Release
+        continue-on-error: true
+        uses: svenstaro/upload-release-action@v2
+        with:
+          repo_token: ${{ secrets.GITHUB_TOKEN }}
+          file: netclient-${{ env.PACKAGE_VERSION }}-1.aarch64.rpm
+          tag: ${{ env.NETMAKER_VERSION }}
+          overwrite: true
+          prerelease: true
+          asset_name: netclient-${{ env.PACKAGE_VERSION }}-1.aarch4.rpm
 
 
+  netclient-mipsle:
+    runs-on: ubuntu-latest
+    needs: version
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set Variables
+        run: |
+          TAG=${{needs.version.outputs.tag}}
+          VERSION=${{needs.version.outputs.version}}
+          echo "NETMAKER_VERSION=${TAG}"  >> $GITHUB_ENV
+          echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
+      - name: Setup go
+        uses: actions/setup-go@v2
+        with:
+          go-version: 1.17
+      - name: Build
+        run: |
+          cd netclient
+          env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'main.version=$NETMAKER_VERSION'" -o build/netclient-mipsle/netclient main.go && upx build/netclient-mipsle/netclient
       - name: Upload mipsle to Release
       - name: Upload mipsle to Release
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
         with:
         with:
@@ -118,6 +278,31 @@ jobs:
           overwrite: true
           overwrite: true
           prerelease: true
           prerelease: true
           asset_name: netclient-mipsle
           asset_name: netclient-mipsle
+   
+  netclient-freebsd:
+    runs-on: ubuntu-latest
+    needs: version
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set Variables
+        run: |
+          TAG=${{needs.version.outputs.tag}}
+          VERSION=${{needs.version.outputs.version}}
+          echo "NETMAKER_VERSION=${TAG}"  >> $GITHUB_ENV
+          echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
+      - name: Setup go
+        uses: actions/setup-go@v2
+        with:
+          go-version: 1.17
+      - name: Build
+        run: |
+          cd netclient
+          env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'main.Version=${NETMAKER_VERSION}'" -o build/netclient-freebsd/netclient main.go
+          env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm5/netclient main.go
+          env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm6/netclient main.go
+          env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm7/netclient main.go
+          env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm64/netclient main.go
 
 
       - name: Upload freebsd to Release
       - name: Upload freebsd to Release
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
@@ -168,8 +353,29 @@ jobs:
           overwrite: true
           overwrite: true
           prerelease: true
           prerelease: true
           asset_name: netclient-freebsd-arm64
           asset_name: netclient-freebsd-arm64
-          
-      - name: Upload darwin to Release
+
+  netclient-darwin:
+    runs-on: ubuntu-latest
+    needs: version
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set Variables
+        run: |
+          TAG=${{needs.version.outputs.tag}}
+          VERSION=${{needs.version.outputs.version}}
+          echo "NETMAKER_VERSION=${TAG}"  >> $GITHUB_ENV
+          echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
+      - name: Setup go                                    
+        uses: actions/setup-go@v2                        
+        with:                                           
+          go-version: 1.17                             
+      - name: Build                                   
+        run: |                                       
+          cd netclient                              
+          env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-darwin/netclient main.go
+          env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-darwin-arm64/netclient main.go
+      - name: Upload darwin-arm64 to Release
         uses: svenstaro/upload-release-action@v2
         uses: svenstaro/upload-release-action@v2
         with:
         with:
           repo_token: ${{ secrets.GITHUB_TOKEN }}
           repo_token: ${{ secrets.GITHUB_TOKEN }}

+ 5 - 4
.github/workflows/purgeGHCR.yml

@@ -1,8 +1,9 @@
 name: Purge untagged images from GHCR
 name: Purge untagged images from GHCR
 
 
 on: 
 on: 
-    workflow_dispatch
-
+    workflow_dispatch:
+    schedule:
+      - cron: '1 1 1 * *'
 jobs:
 jobs:
   purge:
   purge:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
@@ -15,7 +16,7 @@ jobs:
           token: ${{ secrets.GITHUB_TOKEN }}
           token: ${{ secrets.GITHUB_TOKEN }}
           organization: gravitl
           organization: gravitl
           container: netmaker
           container: netmaker
-          dry-run: true # Dry-run first, then change to `false`
+          dry-run: false # Dry-run first, then change to `false`
           untagged: true
           untagged: true
       - name: Prune Netclient
       - name: Prune Netclient
         uses: vlaurin/action-ghcr-prune@main
         uses: vlaurin/action-ghcr-prune@main
@@ -23,6 +24,6 @@ jobs:
           token: ${{ secrets.GITHUB_TOKEN }}
           token: ${{ secrets.GITHUB_TOKEN }}
           organization: gravitl
           organization: gravitl
           container: netclient
           container: netclient
-          dry-run: true # Dry-run first, then change to `false`
+          dry-run: false # Dry-run first, then change to `false`
           untagged: true
           untagged: true
           
           

+ 1 - 0
.gitignore

@@ -6,6 +6,7 @@ netmaker-amd64
 netclient/netclient
 netclient/netclient
 netclient/build
 netclient/build
 netclient/build/
 netclient/build/
+!netclient/build/netclient.service
 netclient/files/netclient
 netclient/files/netclient
 netclient/netclient-amd64
 netclient/netclient-amd64
 netclient/netclient-arm
 netclient/netclient-arm

+ 1 - 1
logic/peers.go

@@ -90,7 +90,7 @@ func GetNodePeers(networkName, nodeid string, excludeRelayed bool, isP2S bool) (
 					}
 					}
 				}
 				}
 			}
 			}
-			if !isP2S || peer.IsHub == "yes" {
+			if (!isP2S || peer.IsHub == "yes") && currentNetworkACLs.IsAllowed(acls.AclID(nodeid), acls.AclID(node.ID)) {
 				peers = append(peers, peer)
 				peers = append(peers, peer)
 			}
 			}
 		}
 		}

+ 15 - 0
netclient/build/netclient.service

@@ -0,0 +1,15 @@
+[Unit]
+Description=Netclient Daemon
+Documentation=https://docs.netmaker.org https://k8s.netmaker.org
+After=network-online.target
+Wants=network-online.target systemd-networkd-wait-online.service
+
+[Service]
+User=root
+Type=simple
+ExecStart=/sbin/netclient daemon
+Restart=on-failure
+RestartSec=15s
+
+[Install]
+WantedBy=multi-user.target