Skip to content

Commit 17c1d82

Browse files
authored
Merge pull request #1 from BitCurator/MERGE/ds
Merge/ds
2 parents dce6482 + 992d01c commit 17c1d82

File tree

10 files changed

+5051
-2
lines changed

10 files changed

+5051
-2
lines changed

.ci/tag-version

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
TAG=${1}
4+
VALID_TAG=false
5+
6+
if [ "x${TAG}" == "x" ]; then
7+
echo "You must specify a tag"
8+
exit 10
9+
fi
10+
11+
if [ ! -f "package.json" ]; then
12+
echo "This script should be run from the root of the directory"
13+
exit 11
14+
fi
15+
16+
BRANCH=$(git symbolic-ref HEAD 2> /dev/null)
17+
BRANCH=${BRANCH##refs/heads/}
18+
19+
if [ "${BRANCH}" != "main" ]; then
20+
echo "You must only be on the main branch"
21+
exit 12
22+
fi
23+
24+
if [ $(echo ${TAG} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$") ]; then
25+
VALID_TAG=true
26+
fi
27+
28+
if [ $(echo ${TAG} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$") ]; then
29+
VALID_TAG=true
30+
fi
31+
32+
if [ $(echo ${TAG} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$") ]; then
33+
VALID_TAG=true
34+
fi
35+
36+
if [ "${VALID_TAG}" == "false" ]; then
37+
echo "The tag specified was invalid."
38+
exit 10
39+
fi
40+
41+
VTAG="v${TAG}"
42+
MSG="version ${TAG}"
43+
44+
npm --no-git-tag-version version $TAG
45+
46+
git commit -a -m "${MSG}"
47+
git tag -m "${MSG}" ${VTAG}
48+
git push origin master
49+
git push origin --tags

.ci/version

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
set -x
4+
5+
version=$(jq -r '.version' package.json || echo dev | sed -e 's/^v//g')
6+
exact_tag=$(git describe --exact-match 2>/dev/null | sed -e 's/^v//g' || echo "")
7+
8+
last_tag=$(git describe --tags --abbrev=0)
9+
commits=$(git log --oneline ${last_tag}..HEAD | wc -l | tr -d '[:space:]')
10+
revision=$(git rev-parse --short HEAD || echo unknown)
11+
12+
if [ $(echo ${exact_tag} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$") ]; then
13+
echo $exact_tag
14+
exit 0
15+
fi
16+
17+
if [ $(echo ${exact_tag} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$") ]; then
18+
echo $exact_tag
19+
exit 0
20+
fi
21+
22+
if [ $(echo ${exact_tag} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$") ]; then
23+
echo $exact_tag
24+
exit 0
25+
fi
26+
27+
echo "${version}.${commits}.g${revision}"

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
release
3+
config.json
4+
.*rc
5+
extras
6+

BUILD.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Building the CLI
2+
### Pre-requisites
3+
- jo
4+
- jq
5+
- gpg
6+
- git
7+
- nodejs (v12 - 14, with npm - see instructions [here](https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions))
8+
9+
```bash
10+
$ sudo apt-get install jo jq gpg nodejs
11+
```
12+
### Modifying
13+
To customize the CLI, it's important to change the following spots in the CLI (as desired):
14+
#### xxx-cli.js
15+
- lines 35-50 (usage)
16+
- lines 56-85 (PGP public key)
17+
- `const help` (line 88)
18+
- `const listReleases` (line 263 - important for pointing to the correct repo)
19+
- `const downloadReleaseFile` (line 321, variable `req`)
20+
- `const downloadRelease` (line 350, variable `req`)
21+
- and anywhere else that might need to be customized for your release.
22+
23+
#### package.json
24+
Important areas to modify:
25+
- `name`
26+
- `version`
27+
- `scripts for pkg:prep/build/hash/sign` (important for signing release)
28+
- `repository: url` (line 40)
29+
30+
#### package-lock.json
31+
Important areas to modify:
32+
- `name`
33+
- `version`
34+
35+
### Building
36+
Change to the CLI directory and run the following:
37+
```bash
38+
$ sudo npm install -g pkg docopt @octokit/rest js-yaml mkdirp openpgp request semver split username bluebird
39+
$ npm install bluebird
40+
$ npm install
41+
```
42+
To avoid having the node_modules folder, and the soon-to-be-created release folder, uploaded during a `git push`, create a `.gitignore` file and ensure these are added.
43+
44+
Now, update the version number in the `package-lock.json` file and the `package.json` file.
45+
46+
While still in the directory, run: `npm run pkg`
47+
48+
This will create the release folder with a `.sha256.asc` signature and the generated binary. Once your build is tested and you're satisfied with the way it turned out, it's time to release it.
49+
50+
### Release
51+
First thing to do would be to add, commit, and push to the repo:
52+
```bash
53+
$ git add -A
54+
$ git commit -m ''
55+
$ git push origin
56+
```
57+
Once your push is complete, generate a tag:
58+
`$ git tag vX.Y.Z` where `X.Y.Z` is your Major/Minor/Patch version number.
59+
60+
Push the tagged release:
61+
`$ git push origin vX.Y.Z`
62+
63+
Go to the Tags section on GitHub, select your tag, and click `Create Release from Tag`
64+
Name this release with the same version number as the tag, then browse to your release folder and upload both files (the binary, and the .sha256.asc file).

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 BitCurator
3+
Copyright (c) 2022 Digital Sleuth
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,110 @@
1-
# bitcurator-cli
1+
![Logo](https://github.com/BitCurator/bitcurator.github.io/blob/main/logos/BitCurator-Basic-400px.png)
2+
3+
# bitcurator-cli
4+
5+
[![GitHub issues](https://img.shields.io/github/issues/bitcurator/bitcurator-salt.svg)](https://github.com/bitcurator/bitcurator-salt/issues)
6+
[![GitHub forks](https://img.shields.io/github/forks/bitcurator/bitcurator-salt.svg)](https://github.com/bitcurator/bitcurator-salt/network)
7+
[![Twitter Follow](https://img.shields.io/twitter/follow/bitcurator.svg?style=social&label=Follow)](https://twitter.com/bitcurator)
8+
9+
BitCurator CLI Installer
10+
11+
This repo contains the source for the BitCurator CLI installer, a command line tool to install and upgrade the BitCurator environment.
12+
13+
You can find pre-built virtual machines (Ubuntu 22.04-based) at https://github.com/BitCurator/bitcurator-distro/wiki/Releases for specific releases. If you wish to create the environment from scratch, you can follow the steps below to install the BitCurator environment on your own physical host or VM.
14+
15+
**Note: BitCurator must be deployed on an x86/amd64 version of Ubuntu. Currently, it is not possible to deploy it on systems with ARM processors (including Apple M1).**
16+
17+
**1. Install Ubuntu 22.04**
18+
19+
Download the 64-bit Ubuntu 22.04 desktop image from https://releases.ubuntu.com/22.04/ubuntu-22.04-desktop-amd64.iso and install on your local machine or in a VM. If you're using a VM, we recommend allocating at least 4GB of RAM and 64GB of disk space to the instance.
20+
21+
To remain consistent with the default configuration of BitCurator, when prompted use **BitCurator** for the Full Name, **bcadmin** for the username, and **bcadmin** for the password.
22+
23+
When installation is completed, reboot, log in, and open a terminal.
24+
25+
**2. Download the BitCurator CLI Installer**
26+
27+
Download the BitCurator installer from iBiblio with the following command:
28+
29+
```shell
30+
wget https://distro.ibiblio.org/bitcurator/bitcurator-cli-linux
31+
```
32+
33+
Verify that the SHA-256 has of the downloaded file matches the value below:
34+
35+
```shell
36+
377065fd9880e511c3c5db7306c5b40dd507ba491a89452cf05f2b570946c5c0
37+
```
38+
39+
You can generate the hash of your downloaded file with:
40+
41+
```shell
42+
sha256sum bitcurator-cli-linux
43+
```
44+
45+
Finally, perform a few setup steps to make the installer executable and place it in the correct location:
46+
47+
```shell
48+
mv bitcurator-cli-linux bitcurator
49+
chmod +x bitcurator
50+
sudo mv bitcurator /usr/local/bin
51+
```
52+
53+
**3. Install GnuPG**
54+
GnuPG is required for BitCurator to automatically validate the configuration files required during installation. Install it using:
55+
56+
```
57+
sudo apt install -y gnupg
58+
```
59+
60+
**4. Run the BitCurator Installer**
61+
62+
```
63+
sudo bitcurator install
64+
```
65+
66+
The installation may take up to an hour, depending on the speed of your system.
67+
68+
If you encounter an error, you may be able to identify the issue by reviewing saltstack.log file under /var/cache/bitcurator/cli in the subdirectory that matches the BitCcurator state-files version you're installing. Search for the log file for result: false messages and look at the surrounding 5 lines or the 8 lines above each message to see the state file that caused the issue. You can do this with:
69+
70+
```shell
71+
grep -i -C 5 'result: false' or grep -i -B 8 'result: false'
72+
```
73+
74+
**5. Reboot**
75+
76+
When the installation is complete, reboot your system from the terminal:
77+
78+
```shell
79+
sudo reboot
80+
```
81+
82+
After the reboot, you will be automatically logged in to BitCurator.
83+
84+
## BitCurator documentation, help, and other information
85+
86+
User documentation and additional resources are available on
87+
[the BitCurator Environment wiki](https://confluence.educopia.org/display/BC).
88+
89+
Questions and comments can also be directed to the bitcurator-users list.
90+
91+
[https://groups.google.com/d/forum/bitcurator-users](https://groups.google.com/d/forum/bitcurator-users)
92+
93+
## Acknowledgements
94+
95+
This tool originally authored by Erik Kristensen, and revised for BitCurator by Corey Forman.
96+
97+
## License(s)
98+
99+
See LICENSE file for details.
100+
101+
The BitCurator logo, BitCurator project documentation, and other non-software products of the BitCurator team are subject to the the Creative Commons Attribution 4.0 Generic license (CC By 4.0).
102+
103+
## Development Team and Support
104+
105+
The BitCurator environment is a product of the BitCurator team housed at the School of Information and Library Science at the University of North Carolina at Chapel Hill. Funding between 2011 and 2014 was provided by the Andrew W. Mellon Foundation.
106+
107+
Ongoing support for the BitCurator environment is managed by the BitCurator Consortium. Find out more at:
108+
109+
http://www.bitcuratorconsortium.net/
110+

0 commit comments

Comments
 (0)