Skip to content

Commit 159d908

Browse files
committed
Add flatpak update script
1 parent 58a9b88 commit 159d908

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

flatpak/update.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
3+
# Example usage
4+
# ./update.sh v0.3.5
5+
6+
version="$1"
7+
8+
if [ $version == '']; then
9+
echo "Invalid version"
10+
exit
11+
fi
12+
13+
pkg_name="fi.mooc.tmc.tmc-cli-rust"
14+
gh_user="flathub"
15+
16+
url='https://download.mooc.fi'
17+
file="$url/tmc-cli-rust/tmc-cli-rust-x86_64-unknown-linux-gnu-$version"
18+
19+
sha256_sum=$(curl $file | sha256sum | awk '{ print $1 }')
20+
21+
yaml="app-id: fi.mooc.tmc.tmc-cli-rust
22+
runtime: org.freedesktop.Platform
23+
runtime-version: '19.08'
24+
sdk: org.freedesktop.Sdk
25+
command: tmc
26+
finish-args:
27+
- --share=network
28+
- --filesystem=host
29+
modules:
30+
- name: tmc
31+
buildsystem: simple
32+
build-commands:
33+
- install -D tmc /app/bin/tmc
34+
- install -Dm644 metainfo.xml /app/share/appdata/fi.mooc.tmc.tmc-cli-rust.appdata.xml
35+
- install -Dm644 64x64.png /app/share/app-info/icons/flatpak/64x64/fi.mooc.tmc.tmc-cli-rust.png
36+
- install -Dm644 128x128.png /app/share/app-info/icons/flatpak/128x128/fi.mooc.tmc.tmc-cli-rust.png
37+
sources:
38+
- type: file
39+
path: 64x64.png
40+
- type: file
41+
path: 128x128.png
42+
- type: file
43+
path: metainfo.xml
44+
- type: file
45+
url: ${file}
46+
sha256: ${sha256_sum}
47+
dest-filename: tmc"
48+
49+
echo "$yaml" > fi.mooc.tmc.tmc-cli-rust.yml
50+
51+
# Pushes changes to Flathub in branch $version
52+
git clone git@github.com:$gh_user/$pkg_name
53+
if [ -d "./$pkg_name" ]; then
54+
rm $pkg_name/$pkg_name.yml
55+
cp $pkg_name.yml $pkg_name
56+
cd $pkg_name
57+
git branch $version
58+
git checkout $version
59+
git add .
60+
git commit -m "Update to $version"
61+
git push --set-upstream origin $version
62+
cd ..
63+
sudo rm -r $pkg_name
64+
else
65+
echo "No permissions to $pkg_name"
66+
fi

0 commit comments

Comments
 (0)