Skip to content

Commit 0d09151

Browse files
committed
0.1.0
0 parents  commit 0d09151

File tree

11 files changed

+1276
-0
lines changed

11 files changed

+1276
-0
lines changed

.github/workflows/release.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release
2+
3+
# This workflow must be started manually
4+
on: workflow_dispatch
5+
6+
# Build and then upload a release
7+
jobs:
8+
release:
9+
name: Build binary packages
10+
# Run the job on an instance of MacOS (not linux because we need
11+
# MacOS to build an osxpkg)
12+
runs-on: macos-latest
13+
steps:
14+
# `git clone` the repo
15+
- name: Check out repo
16+
uses: actions/checkout@v1
17+
# Setup ruby
18+
- name: Setup ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: 3.0.0
22+
# Install the fpm gem to build packages
23+
- name: Install fpm
24+
run: gem install fpm
25+
# Install fpm dependencies
26+
- name: Install fpm dependencies
27+
run: scripts/prep-build-env
28+
# Build the binaries
29+
- name: Build binaries using fpm
30+
run: scripts/dist
31+
# Get the version number from the release tag
32+
- name: Get version number for release tag
33+
id: version-number
34+
run: echo "::set-output name=version::$(cat version)"
35+
# Upload the release
36+
- name: Create GitHub release
37+
uses: softprops/action-gh-release@v1
38+
with:
39+
body: |
40+
```
41+
== bak ${{ steps.version-number.outputs.version }} ==
42+
43+
-- [changelog.txt](https://github.com/gamemaker1/bak/blob/main/changelog.txt)
44+
45+
-- More on installation and usage can be found [here](https://github.com/gamemaker1/bak/#readme).
46+
-- Please report any bugs or submit ideas/feature requests [here](https://github.com/gamemaker1/bak/issues).
47+
48+
-- Thanks for using bak!
49+
```
50+
tag_name: ${{ steps.version-number.outputs.version }}
51+
name: Bak ${{ steps.version-number.outputs.version }}
52+
files: dist/*
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
GITHUB_REPO: gamemaker1/bak

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/ignore
2+
/dist

changelog.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
== changelog ==
3+
4+
-- 0.1.0 --
5+
6+
* Initial release; yay!
7+
* Supports the -c, -C, -f, -d and -e flags.
8+
* Supports creating archives using tar (gzip, xz, zstd, bzip2) and zip.
9+
* Supports computing checksums of all files inside the archive using md5, sha1, sha224, sha384, sha256, sha512 and b2.
10+
* Binary packages contain the manpage and license along with the program.
11+
* Binary packages are built for Debian, RedHat, Arch Linux, Alpine Linux, Snap, FreeBSD, and MacOS, along with a generic tarball.

license.txt

Lines changed: 617 additions & 0 deletions
Large diffs are not rendered by default.

man/bak.1

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.TH BAK "1" "July 2021" "bak 0.1.0" "User Commands"
2+
.SH NAME
3+
bak \- manual page for bak 0.1.0
4+
.SH DESCRIPTION
5+
.IP
6+
USAGE: bak [options] <files/dirs to backup>...
7+
.HP
8+
\fB\-h\fR, \fB\-\-help\fR
9+
.IP
10+
Print this help menu and exit
11+
.HP
12+
\fB\-v\fR, \fB\-\-version\fR
13+
.IP
14+
Print the version number and exit
15+
.TP
16+
\fB\-c\fR, \fB\-\-compress\-using\fR <format>
17+
[default: tar\-gz] tar\-gz, tar\-xz, tar\-zst, tar\-bz, zip
18+
.IP
19+
Compression format to use while creating the backup
20+
.TP
21+
\fB\-C\fR, \fB\-\-compute\-checksums\-using\fR <type>
22+
[default: sha256] md5, sha1, sha224, sha384, sha256, sha512, b2
23+
.IP
24+
Compute checksums for all files in the archive
25+
.TP
26+
\fB\-f\fR, \fB\-\-file\-name\fR <file\-name>
27+
[default: <date>.bak.<extension>]
28+
.IP
29+
Specify the name of the created backup file
30+
.TP
31+
\fB\-d\fR, \fB\-\-backup\-directory\fR <path\-to\-dir>
32+
[default: ~/Backups]
33+
.IP
34+
Specify the path to directory to put the backup file in
35+
.HP
36+
\fB\-e\fR, \fB\-\-exclude\-pattern\fR <file/dir name/pattern to exclude>
37+
.IP
38+
Specify patterns or names of files/dirs to exclude from the archive; if you want them
39+
to be ignored recursively (across subdirectories), make sure you prefix it with '**/'
40+
.SH "SEE ALSO"
41+
.IP
42+
You can find the source for this program on GitHub: https://github.com/gamemaker1/bak/
43+
.SH "OTHER"
44+
.IP
45+
Made by Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>
46+
.IP
47+
This program is distributed under the AGPL 3.0 license.

readme.txt

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
2+
== bak 0.1.0 ==
3+
4+
A backup tool (written in bash)
5+
6+
-- INSTALLATION --
7+
8+
The latest releases for various platforms can be found here: https://github.com/gamemaker1/bak/releases/latest
9+
10+
* Debian - .DEB
11+
* RedHat - .RPM
12+
* Arch Linux - .pkg.tar.zst [Also on AUR as bak, bak-bin or bak-git]
13+
* Alpine Linux - .apk
14+
* Snap - .snap
15+
* FreeBSD - .freebsd
16+
* MacOS - .pkg
17+
* Generic - .tar.gz
18+
19+
Manual installation can be done by downloading and extracting the files from
20+
the `Generic` release. Here is where to put the files from the archive:
21+
22+
* source/bak => /usr/bin/bak
23+
* man/bak.1 => /usr/share/man/man1/bak.1
24+
* license.txt => /usr/share/licenses/bak/LICENSE
25+
26+
-- DEPENDENCIES --
27+
28+
* bash
29+
* coreutils
30+
* tar
31+
* zip
32+
* unzip
33+
34+
-- USAGE --
35+
36+
bak [options] <files/dirs to backup>...
37+
38+
-c, --compress-using [default: tar-gz] tar-gz, tar-xz, tar-zst, tar-bzip2, zip
39+
Compression format to use while creating the backup
40+
-C, --compute-checksums-using [default: sha256] md5, sha1, sha224, sha384, sha256, sha512, b2
41+
Compute checksums for all files in the archive
42+
-f, --file-name [default: <date>.bak.<extension>]
43+
Name of resulting backup file
44+
-d, --backup-directory [default: ~/Backups]
45+
Directory to place the resulting backup file in
46+
-e, --exclude-pattern <file/dir name/pattern to exclude>
47+
Pattern or name of file/dir to exclude from the archive
48+
49+
-- ISSUES/CONTRIBUTING --
50+
51+
Please feel free to open an issue on Github if the program does not work as
52+
expected, or submit a pull request if you want to add a feature/fix a bug.
53+
54+
-- LICENSE --
55+
56+
This project is licensed under AGPL 3.0. A copy of the license can be found
57+
in the /license.txt file.
58+
59+
bak 0.1.0 - A backup tool written in bash
60+
Copyright (C) 2021 Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>
61+
62+
This program is free software: you can redistribute it and/or modify
63+
it under the terms of the GNU Affero General Public License as published by
64+
the Free Software Foundation, either version 3 of the License, or
65+
(at your option) any later version.
66+
67+
This program is distributed in the hope that it will be useful,
68+
but WITHOUT ANY WARRANTY; without even the implied warranty of
69+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70+
GNU Affero General Public License for more details.
71+
72+
You should have received a copy of the GNU Affero General Public License
73+
along with this program. If not, see https://www.gnu.org/licenses/.

scripts/bump-ver

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# == version bump script ==
5+
#
6+
# Finds and replaces the current version with the new one (new one must be
7+
# supplied as a command line argument)
8+
#
9+
# Run from project root please!
10+
#
11+
12+
# Get the old version from the version file and the new one as the first argument
13+
old_version="$(cat version)"
14+
new_version="$1"
15+
16+
# Error out if the new version is not specified
17+
if [[ -z "$new_version" ]]
18+
then
19+
echo "Current version: $old_version; please provide the new version as the first argument; i.e.: $0 0.1.1"
20+
exit 1
21+
fi
22+
23+
# Replace all occurrences of the old version with the new one (except in changelog.txt)
24+
sed -i "s/$old_version/$new_version/g" man/bak.1
25+
sed -i "s/$old_version/$new_version/g" source/bak
26+
sed -i "s/$old_version/$new_version/g" readme.txt
27+
sed -i "s/$old_version/$new_version/g" version

scripts/dist

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# == dist script ==
5+
#
6+
# Bundle up `bak` for:
7+
# * Debian - .DEB
8+
# * RedHat - .RPM
9+
# * Arch Linux - .pkg.tar.zst
10+
# * Alpine Linux - .apk
11+
# * Snap - .snap
12+
# * FreeBSD - .freebsd
13+
# * MacOS - .pkg
14+
# * Generic - .tar.gz
15+
#
16+
# Run from project root please!
17+
# WARNING: The scripts in this folder are written specifically to run on MacOS [via Github Actions]
18+
#
19+
20+
# Ensure the `dist` directory exists
21+
rm -rf dist
22+
mkdir -p dist
23+
24+
# Debian
25+
fpm --log error \
26+
-s dir -t deb \
27+
-p dist/bak-$(cat version)-1-any.deb \
28+
--name bak \
29+
--license agpl3 \
30+
--version $(cat version) \
31+
--architecture all \
32+
--depends bash --depends coreutils --depends tar --depends zip --depends unzip \
33+
--description "A backup tool written in bash" \
34+
--url "https://github.com/gamemaker1/bak" \
35+
--maintainer "Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>" \
36+
--deb-changelog changelog.txt \
37+
source/bak=/usr/bin/bak man/bak.1=/usr/share/man/man1/bak.1 license.txt=/usr/share/licenses/bak/LICENSE
38+
39+
# RedHat
40+
fpm --log error \
41+
-s dir -t rpm \
42+
-p dist/bak-$(cat version)-1-any.rpm \
43+
--name bak \
44+
--license agpl3 \
45+
--version $(cat version) \
46+
--architecture all \
47+
--depends bash --depends coreutils --depends tar --depends zip --depends unzip \
48+
--description "A backup tool written in bash" \
49+
--url "https://github.com/gamemaker1/bak" \
50+
--maintainer "Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>" \
51+
--rpm-changelog changelog.txt \
52+
source/bak=/usr/bin/bak man/bak.1=/usr/share/man/man1/bak.1 license.txt=/usr/share/licenses/bak/LICENSE
53+
54+
# Arch Linux
55+
fpm --log error \
56+
-s dir -t pacman \
57+
-p dist/bak-$(cat version)-1-any.pkg.tar.zst \
58+
--name bak \
59+
--license agpl3 \
60+
--version $(cat version) \
61+
--architecture all \
62+
--depends bash --depends coreutils --depends tar --depends zip --depends unzip \
63+
--description "A backup tool written in bash" \
64+
--url "https://github.com/gamemaker1/bak" \
65+
--maintainer "Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>" \
66+
source/bak=/usr/bin/bak man/bak.1=/usr/share/man/man1/bak.1 license.txt=/usr/share/licenses/bak/LICENSE
67+
68+
# Alpine Linux
69+
fpm --log error \
70+
-s dir -t apk \
71+
-p dist/bak-$(cat version)-1-any.apk \
72+
--name bak \
73+
--license agpl3 \
74+
--version $(cat version) \
75+
--architecture all \
76+
--depends bash --depends coreutils --depends tar --depends zip --depends unzip \
77+
--description "A backup tool written in bash" \
78+
--url "https://github.com/gamemaker1/bak" \
79+
--maintainer "Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>" \
80+
source/bak=/usr/bin/bak man/bak.1=/usr/share/man/man1/bak.1 license.txt=/usr/share/licenses/bak/LICENSE
81+
82+
# Snap
83+
fpm --log error \
84+
-s dir -t snap \
85+
-p dist/bak-$(cat version)-1-any.snap \
86+
--name bak \
87+
--license agpl3 \
88+
--version $(cat version) \
89+
--architecture all \
90+
--depends bash --depends coreutils --depends tar --depends zip --depends unzip \
91+
--description "A backup tool written in bash" \
92+
--url "https://github.com/gamemaker1/bak" \
93+
--maintainer "Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>" \
94+
source/bak=/usr/bin/bak man/bak.1=/usr/share/man/man1/bak.1 license.txt=/usr/share/licenses/bak/LICENSE
95+
96+
# FreeBSD
97+
fpm --log error \
98+
-s dir -t freebsd \
99+
-p dist/bak-$(cat version)-1-any.freebsd \
100+
--name bak \
101+
--license agpl3 \
102+
--version $(cat version) \
103+
--architecture all \
104+
--depends bash --depends coreutils --depends tar --depends zip --depends unzip \
105+
--description "A backup tool written in bash" \
106+
--url "https://github.com/gamemaker1/bak" \
107+
--maintainer "Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>" \
108+
source/bak=/usr/bin/bak man/bak.1=/usr/share/man/man1/bak.1 license.txt=/usr/share/licenses/bak/LICENSE
109+
110+
# MacOS
111+
fpm --log error \
112+
-s dir -t osxpkg \
113+
-p dist/bak-$(cat version)-1-any.pkg \
114+
--name bak \
115+
--license agpl3 \
116+
--version $(cat version) \
117+
--architecture all \
118+
--depends bash --depends coreutils --depends tar --depends zip --depends unzip \
119+
--description "A backup tool written in bash" \
120+
--url "https://github.com/gamemaker1/bak" \
121+
--maintainer "Vedant K (gamemaker1) <gamemaker0042 at gmail dot com>" \
122+
source/bak=/usr/bin/bak man/bak.1=/usr/share/man/man1/bak.1 license.txt=/usr/share/licenses/bak/LICENSE
123+
124+
# Generic
125+
tar -czf dist/bak-$(cat version)-1-any.tar.gz man source changelog.txt license.txt readme.txt version

scripts/prep-build-env

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# == prepare env script ==
5+
#
6+
# Install stuff required for FPM to run on MacOS [Github actions]
7+
#
8+
# Run from project root please!
9+
# WARNING: The scripts in this folder are written specifically to run on MacOS [via Github Actions]
10+
#
11+
12+
# The Github Action will already have setup Ruby v3.0.0
13+
14+
# Install fpm dependecies
15+
# Install rpm to build a .rpm
16+
brew install rpm
17+
# Install gtar to build a .pkg.tar.zst
18+
brew install gnu-tar
19+
# Install squashfs to build a snap package
20+
brew install squashfs
21+
22+
# Install fpm itself
23+
gem install fpm

0 commit comments

Comments
 (0)