Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
b1562e7d33
|
|||
e293c02fbb
|
|||
e0ddbff0d1
|
|||
fc910ed1e6
|
15
README.md
15
README.md
@@ -1,16 +1,17 @@
|
|||||||
# Octozipo
|
<h2><img align="middle" src="https://raw.githubusercontent.com/odb/official-bash-logo/master/assets/Logos/Icons/PNG/64x64.png" >
|
||||||
|
Octozipo - Convert Zip package to a repository.
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
Written by Llewellyn van der Merwe (@llewellynvdm)
|
||||||
|
|
||||||
Convert Zip packages to repositories and if they exist update and tag them.
|
Convert Zip packages to repositories and if they exist update and tag them.
|
||||||
|
|
||||||
|
Linted by [#ShellCheck](https://github.com/koalaman/shellcheck)
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
## Get needed access token
|
|
||||||
|
|
||||||
Get a token from [https://git.vdm.dev/user/settings/applications](https://git.vdm.dev/user/settings/applications)
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ export SETUP_TOKEN="xxxxxxxxxxtokenxxxxxxxxxxxxxxxxxxxxxxxx"
|
$ sudo curl -L "https://git.vdm.dev/api/v1/repos/octoleo/octozipo/raw/src/octozipo" -o /usr/local/bin/octozipo
|
||||||
$ sudo curl -L "https://git.vdm.dev/api/v1/repos/octoleo/octozipo/raw/src/octozipo?access_token=${SETUP_TOKEN}" -o /usr/local/bin/octozipo
|
|
||||||
$ sudo chmod +x /usr/local/bin/octozipo
|
$ sudo chmod +x /usr/local/bin/octozipo
|
||||||
```
|
```
|
||||||
- Global **environment** file can be set at: `/home/$USER/.config/octozipo/.env`
|
- Global **environment** file can be set at: `/home/$USER/.config/octozipo/.env`
|
||||||
|
12
src/octozipo
12
src/octozipo
@@ -3,7 +3,7 @@
|
|||||||
# Program name
|
# Program name
|
||||||
PROGRAM_NAME="Octozipo"
|
PROGRAM_NAME="Octozipo"
|
||||||
PROGRAM_CODE="octozipo"
|
PROGRAM_CODE="octozipo"
|
||||||
PROGRAM_VERSION="2.2.5"
|
PROGRAM_VERSION="2.2.7"
|
||||||
PROGRAM_V="2.2"
|
PROGRAM_V="2.2"
|
||||||
# PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
|
# PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ main() {
|
|||||||
# get the package details
|
# get the package details
|
||||||
getPackageDetails "${zip_name}" "${folder_name}"
|
getPackageDetails "${zip_name}" "${folder_name}"
|
||||||
# check if the repo exist on our system
|
# check if the repo exist on our system
|
||||||
if git ls-remote --exit-code --heads "git@${VDM_GIT_URL}:${VDM_ORG}/${VDM_REPO_NAME}.git" "${VDM_REPO_BRANCH}" -q >/dev/null 2>&1; then
|
if git ls-remote --exit-code --heads "git@${VDM_GIT_URL}:${VDM_ORG}/${VDM_REPO_NAME}.git" "${VDM_REPO_BRANCH}" >/dev/null 2>&1; then
|
||||||
# check if repo is locally found
|
# check if repo is locally found
|
||||||
cd "${VDM_PATH_REPO}" >/dev/null 2>&1 || {
|
cd "${VDM_PATH_REPO}" >/dev/null 2>&1 || {
|
||||||
git clone "git@${VDM_GIT_URL}:${VDM_ORG}/${VDM_REPO_NAME}.git" \
|
git clone "git@${VDM_GIT_URL}:${VDM_ORG}/${VDM_REPO_NAME}.git" \
|
||||||
@@ -678,7 +678,7 @@ function getGitCommitComment() {
|
|||||||
|
|
||||||
# check if this is the same version as the current version
|
# check if this is the same version as the current version
|
||||||
if [ "$current_version" = "$version" ]; then
|
if [ "$current_version" = "$version" ]; then
|
||||||
message="Stable release of ${current_version}\n\n${formatted_lines}"
|
message="Release of ${current_version}\n\n${formatted_lines}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -806,7 +806,7 @@ function getVersionNumberByFile() {
|
|||||||
|
|
||||||
function rightStrip() {
|
function rightStrip() {
|
||||||
# Usage: rightStrip "string" "pattern"
|
# Usage: rightStrip "string" "pattern"
|
||||||
printf '%s\n' "${1%%$2}"
|
printf '%s\n' "${1%%"$2"}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# leftStrip - Removes the specified pattern from the start of a string
|
# leftStrip - Removes the specified pattern from the start of a string
|
||||||
@@ -824,7 +824,7 @@ function rightStrip() {
|
|||||||
# The modified string with the pattern removed from the start
|
# The modified string with the pattern removed from the start
|
||||||
function leftStrip() {
|
function leftStrip() {
|
||||||
# Usage: leftStrip "string" "pattern"
|
# Usage: leftStrip "string" "pattern"
|
||||||
printf '%s\n' "${1##$2}"
|
printf '%s\n' "${1##"$2"}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function unzips the package located in the `VDM_ZIP_DIR` directory to the specified folder.
|
# This function unzips the package located in the `VDM_ZIP_DIR` directory to the specified folder.
|
||||||
@@ -934,7 +934,7 @@ function runUpdate() {
|
|||||||
sudo mv "/usr/local/bin/${PROGRAM_CODE}" "/usr/local/bin/${PROGRAM_CODE}.bak"
|
sudo mv "/usr/local/bin/${PROGRAM_CODE}" "/usr/local/bin/${PROGRAM_CODE}.bak"
|
||||||
fi
|
fi
|
||||||
# pull the latest version. Master is always the latest
|
# pull the latest version. Master is always the latest
|
||||||
if sudo curl --fail -L "https://git.vdm.dev/api/v1/repos/octoleo/${PROGRAM_CODE}/raw/src/${PROGRAM_CODE}?ref=${branch:-master}&access_token=${VDM_ACCESS_TOKEN}" -o "/usr/local/bin/${PROGRAM_CODE}" 2>/dev/null; then
|
if sudo curl --fail -H "Authorization: token ${VDM_ACCESS_TOKEN}" -L "https://git.vdm.dev/api/v1/repos/octoleo/${PROGRAM_CODE}/raw/src/${PROGRAM_CODE}?ref=${branch:-master}" -o "/usr/local/bin/${PROGRAM_CODE}" 2>/dev/null; then
|
||||||
# give success message
|
# give success message
|
||||||
_echo "[success] Update was successful."
|
_echo "[success] Update was successful."
|
||||||
# do we have a backup
|
# do we have a backup
|
||||||
|
Reference in New Issue
Block a user