-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_gh-clone-all.sh
More file actions
64 lines (59 loc) · 1.88 KB
/
install_gh-clone-all.sh
File metadata and controls
64 lines (59 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
######################################################################
# Name: install_gh-clone-all.sh
#
# Description: This script automates the process of downloading and
# installing a package from a GitHub release.
#
# Details:
# - It constructs the download URL based on the repository name,
# package name, and version.
# - Uses curl to download the .deb package.
# - Installs the package using dpkg, and if there are dependency issues,
# attempts to correct them using apt-get.
# - Cleans up by removing the downloaded package file.
# - Runs the installed software.
#
# Requirements:
# - curl, dpkg, and apt-get must be available on the system.
# - The script must be run with sufficient privileges to install packages.
#
# Usage:
# Run this script to automatically download and install the specified
# package from its GitHub release URL.
#
# Author: github.com/brooks-code
# Date: 2026-04-06
# Listening: Any other name by Thomas Newman (1999)
######################################################################
set -e
REPO="brooks-code/clone-github-user-repos"
VERSION="v1.0.0"
PKG="gh-clone-all_${VERSION#v}_all.deb"
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${PKG}"
CMD="gh-clone-all"
echo "Downloading ${PKG} from ${DOWNLOAD_URL}..."
curl -L -o "${PKG}" "${DOWNLOAD_URL}"
# Try installing; if dependencies fail, attempt to fix and reinstall
echo "Installing ${PKG}..."
if sudo dpkg -i "${PKG}"; then
INSTALL_OK=1
else
sudo apt-get update
if sudo apt-get install -f -y && sudo dpkg -i "${PKG}"; then
INSTALL_OK=1
else
INSTALL_OK=0
fi
fi
echo "Cleaning up the package..."
rm -f "${PKG}"
if [ "${INSTALL_OK}" -eq 1 ]; then
echo "Installation successful!"
echo "Running ${CMD} once... (hit ctrl + C to abort)."
hash -r
"${CMD}"
else
echo "Installation failed." >&2
exit 1
fi