4 Commits

Author SHA1 Message Date
b1562e7d33 Update program version and fix git command output handling
Bump the program version from 2.2.6 to 2.2.7. Remove unnecessary [-q] flag from the [git ls-remote] command to ensure proper output handling and improve compatibility.
2025-04-23 20:20:26 +02:00
e293c02fbb Make this repo public :) 2025-01-09 12:26:13 +02:00
e0ddbff0d1 Add bash logo, written by, linted by to README. 2024-03-20 16:26:36 +02:00
fc910ed1e6 Change the release commit message to ommit Stable, since we don't know. Fix update token issue, so that it is added to the header. 2024-03-12 12:33:25 +02:00
2 changed files with 14 additions and 13 deletions

View File

@@ -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.
Linted by [#ShellCheck](https://github.com/koalaman/shellcheck)
## Install
## Get needed access token
Get a token from [https://git.vdm.dev/user/settings/applications](https://git.vdm.dev/user/settings/applications)
```shell
$ export SETUP_TOKEN="xxxxxxxxxxtokenxxxxxxxxxxxxxxxxxxxxxxxx"
$ 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 curl -L "https://git.vdm.dev/api/v1/repos/octoleo/octozipo/raw/src/octozipo" -o /usr/local/bin/octozipo
$ sudo chmod +x /usr/local/bin/octozipo
```
- Global **environment** file can be set at: `/home/$USER/.config/octozipo/.env`

View File

@@ -3,7 +3,7 @@
# Program name
PROGRAM_NAME="Octozipo"
PROGRAM_CODE="octozipo"
PROGRAM_VERSION="2.2.5"
PROGRAM_VERSION="2.2.7"
PROGRAM_V="2.2"
# PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
@@ -84,7 +84,7 @@ main() {
# get the package details
getPackageDetails "${zip_name}" "${folder_name}"
# 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
cd "${VDM_PATH_REPO}" >/dev/null 2>&1 || {
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
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
@@ -806,7 +806,7 @@ function getVersionNumberByFile() {
function rightStrip() {
# 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
@@ -824,7 +824,7 @@ function rightStrip() {
# The modified string with the pattern removed from the start
function leftStrip() {
# 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.
@@ -934,7 +934,7 @@ function runUpdate() {
sudo mv "/usr/local/bin/${PROGRAM_CODE}" "/usr/local/bin/${PROGRAM_CODE}.bak"
fi
# 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
_echo "[success] Update was successful."
# do we have a backup