-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy Install script to pages | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v5 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: 'scripts/install.sh' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
|
||
## check for root privileges | ||
if [ "$EUID" -ne 0 ]; then | ||
echo "Please run as root" | ||
exit | ||
fi | ||
|
||
# Variables | ||
REPO="coolapso/megophone" # Replace 'user/megophone' with the actual repository path | ||
VERSION=${1:-"latest"} | ||
INSTALL_DIR="/usr/local/bin" | ||
|
||
# Determine OS and Architecture | ||
OS=$(uname | tr '[:upper:]' '[:lower:]') | ||
ARCH=$(uname -m) | ||
if [[ "$ARCH" == "x86_64" ]]; then | ||
ARCH="amd64" | ||
elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then | ||
ARCH="arm64" | ||
elif [[ "$ARCH" == "i386" || "$ARCH" == "i686" ]]; then | ||
ARCH="386" | ||
fi | ||
|
||
# Fetch the latest release if no version is specified | ||
if [[ "$VERSION" == "latest" ]]; then | ||
VERSION=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | ||
fi | ||
|
||
# Download URL for the release file and checksum | ||
FILE="megophone_${VERSION:1}_${OS}_${ARCH}.tar.gz" | ||
FILE_URL="https://github.com/$REPO/releases/download/$VERSION/$FILE" | ||
|
||
# Download the file and checksum | ||
if ! curl -LO "$FILE_URL"; then | ||
echo "Failed to download $FILE_URL" | ||
exit 1 | ||
fi | ||
|
||
# Extract and install | ||
if ! tar xzf "$FILE"; then | ||
echo "Failed to extract $FILE" | ||
exit 1 | ||
fi | ||
|
||
## Install the binary | ||
if ! chmod +x megophone; then | ||
echo "Failed to make megophone executable" | ||
exit 1 | ||
fi | ||
|
||
if ! mv megophone "$INSTALL_DIR" ; then | ||
echo "Failed to move megophone to $INSTALL_DIR" | ||
exit 1 | ||
fi | ||
|
||
# Cleanup | ||
if ! rm "$FILE"; then | ||
echo "Failed to remove $FILE" | ||
exit 1 | ||
fi | ||
|
||
echo "Installation of $REPO version $VERSION complete." |