Skip to content

Commit

Permalink
Added 0install bootstrap scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Sep 21, 2020
1 parent e08e766 commit bc8623a
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 20 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Set up 0install
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends 0install-core python-gobject rpm2cpio
- name: Clone feeds
uses: actions/checkout@v2
with:
Expand All @@ -28,6 +26,6 @@ jobs:
git config --global user.email "[email protected]"
echo "${{ secrets.GPG_KEY }}" | gpg --import -
- name: Run 0repo
run: 0install run --not-before 0.10 http://0install.net/tools/0repo.xml
run: ./feeds/0install.sh run --not-before 0.10 http://0install.net/tools/0repo.xml
- name: Push public
run: cd public && git push
15 changes: 4 additions & 11 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ jobs:
windows:
runs-on: windows-latest
steps:
- name: Set up 0install
run: |
Invoke-WebRequest https://0install.de/files/0install.exe -OutFile 0install.exe
echo "::add-path::$env:GITHUB_WORKSPACE"
- name: Clone feeds
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -55,11 +51,6 @@ jobs:
runs-on: ubuntu-latest
needs: [windows, macos]
steps:
- name: Set up 0install
run: |
sudo apt-get update && sudo apt-get install -y python-gobject python3-gnupg unzip rpm2cpio binutils
curl -L https://downloads.sourceforge.net/zero-install/0install-linux-x86_64-2.15.2.tar.bz2 | tar xj
sudo 0install-linux-x86_64-2.15.2/install.sh local
- name: Clone feeds
uses: actions/checkout@v2
with:
Expand All @@ -76,7 +67,9 @@ jobs:
mkdir incoming
- name: Run 0watch
env: {'CI': '1'}
run: feeds/watch.sh
run: |
sudo apt-get install -y python3-gnupg
feeds/watch.sh
- name: Upload generated feeds
uses: actions/upload-artifact@v1
with:
Expand All @@ -97,7 +90,7 @@ jobs:
- name: Run 0repo
if: env.NEW_INCOMING
env: {'NO_SIGN': '1'}
run: 0install run --not-before 0.10 http://0install.net/tools/0repo.xml
run: ./feeds/0install.sh run --not-before 0.10 http://0install.net/tools/0repo.xml
- name: Create Pull Request
if: env.NEW_INCOMING
uses: peter-evans/create-pull-request@v2
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Set up 0install
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends 0install-core python-gobject rpm2cpio
- name: Clone feeds
uses: actions/checkout@v2
with:
Expand All @@ -24,4 +22,4 @@ jobs:
mkdir incoming
- name: Run 0repo
env: {'NO_SIGN': '1'}
run: 0install run --not-before 0.10 http://0install.net/tools/0repo.xml
run: ./feeds/0install.sh run --not-before 0.10 http://0install.net/tools/0repo.xml
17 changes: 17 additions & 0 deletions 0install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$ErrorActionPreference = "Stop"

function download {
$downloadDir = "$env:LOCALAPPDATA\0install.net\bootstrapper"
if (!(Test-Path "$downloadDir\0install.exe")) {
mkdir -Force $downloadDir | Out-Null
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls11,Tls12'
Invoke-WebRequest "https://get.0install.net/0install.exe" -OutFile "$downloadDir\0install.exe"
}
return $downloadDir
}

if (Get-Command 0install -ErrorAction SilentlyContinue) {
0install @args
} else {
. "$(download)\0install.exe" @args
}
21 changes: 21 additions & 0 deletions 0install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
set -e

download() {
zeroinstall_release=0install-$(uname | tr '[:upper:]' '[:lower:]')-$(uname -m)-${ZEROINSTALL_VERSION:-latest}
download_dir=~/.cache/0install.net/$zeroinstall_release

if [ ! -f $download_dir/files/0install ]; then
echo "Downloading 0install..." >&2
rm -rf $download_dir
mkdir -p $download_dir
curl -sSL https://get.0install.net/$zeroinstall_release.tar.bz2 | tar xj --strip-components 1 --directory $download_dir
fi
}

if command -v 0install > /dev/null 2> /dev/null; then
0install "$@"
else
download
$download_dir/files/0install "$@"
fi
4 changes: 2 additions & 2 deletions watch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ foreach ($file in (ls -Recurse -Filter *.watch.py).FullName) {
$header = Get-Content $file -TotalCount 1
if (($header -eq "#os=Windows") -or (-not $header.StartsWith("#os="))) {
echo $file
#cmd /c "0install run --batch https://apps.0install.net/0install/0watch.xml --output ..\incoming $file 2>&1" # Redirect stderr to stdout
cmd /c "0install run --batch 0watch-windows.xml.selections --output ..\incoming $file 2>&1" # Redirect stderr to stdout
#.\0install.ps1 run --batch https://apps.0install.net/0install/0watch.xml --output ..\incoming $file
.\0install.ps1 run --batch 0watch-windows.xml.selections --output ..\incoming $file
}
}

Expand Down
2 changes: 1 addition & 1 deletion watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ for FILE in $(ls */*.watch.py); do
#if [[ $header == "#os=$(uname)" ]] || [[ $header != \#os=* ]]; then
if [[ $header == "#os=$(uname)" ]]; then
echo $FILE
0install run --version-for=http://0install.net/2007/interfaces/ZeroInstall.xml 2.3.12.. https://apps.0install.net/0install/0watch.xml --output ../incoming $FILE
./0install.sh run --version-for=http://0install.net/2007/interfaces/ZeroInstall.xml 2.3.12.. https://apps.0install.net/0install/0watch.xml --output ../incoming $FILE
fi
done

0 comments on commit bc8623a

Please sign in to comment.