Skip to content

Commit 3daab91

Browse files
committed
Add non-interactive source install, update deb-rpm check according to new releases
1 parent ecae83c commit 3daab91

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

installers/dunner/install.sh

100644100755
Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ REPO_URL="https://github.com/leopardslab/dunner"
1212
API_URL="https://api.github.com/repos/leopardslab/dunner/releases"
1313

1414
initVersion() {
15+
echo "Checking from versions available..."
1516
# Resolve latest version
1617
if [[ $VERSION == 'latest' ]]; then
1718
VERSION=$(curl -s ${API_URL}/latest | grep -wo '"tag_name":\ .*' | sed s/'"tag_name":\ "'//g | sed s/'",'//g)
@@ -104,21 +105,27 @@ binInstall() {
104105
else
105106
echo "'tar' command not found..."
106107
echo
107-
promptSrcInstall
108+
if [[ $1 == '-y' ]]; then
109+
installFromSource
110+
else
111+
promptSrcInstall
112+
fi
108113
fi
109114
}
110115

111116
initInstall() {
112117
ARCH=$(uname -m)
113-
if [[ $ARCH == 'i386' ]]; then
114-
ARCH="386"
115-
elif [[ $ARCH == 'x86_64' ]]; then
116-
ARCH="amd64"
117-
fi
118+
OS=$(uname -s)
119+
ver=$(echo $VERSION | sed s/v//g)
120+
# if [[ $ARCH == 'i386' ]]; then
121+
# ARCH="386"
122+
# elif [[ $ARCH == 'x86_64' ]]; then
123+
# ARCH="amd64"
124+
# fi
118125
if [[ $(which dpkg) ]]; then
119-
pkg=$(curl -s ${API_URL}/tags/${VERSION} | grep -io "\"name\": \"dunner_${ARCH}\.deb" | sed s/'"name": "'//g)
126+
pkg=$(curl -s ${API_URL}/tags/${VERSION} | grep -io "\"name\": \"dunner_${ver}_${OS}_${ARCH}\.deb" | sed s/'"name": "'//g)
120127
if [[ -z $pkg ]]; then
121-
echo "Deb package not found for $ARCH for version $VERSION"
128+
echo "Deb package not found for $OS-$ARCH for version $VERSION"
122129
else
123130
downloadUrl="${RELEASES_URL}/download/${VERSION}/${pkg}"
124131
echo "Downloading ${pkg} as dunner.deb..."
@@ -131,7 +138,7 @@ initInstall() {
131138
fi
132139

133140
if [[ $(which rpm) ]]; then
134-
pkg=$(curl -s ${API_URL}/tags/${VERSION} | grep -io "\"name\": \"dunner_${ARCH}\.rpm" | sed s/'"name": "'//g)
141+
pkg=$(curl -s ${API_URL}/tags/${VERSION} | grep -io "\"name\": \"dunner_${ver}_${OS}_${ARCH}\.rpm" | sed s/'"name": "'//g)
135142
if [[ -z $pkg ]]; then
136143
echo "RPM package not found for $OS-$ARCH for version $VERSION"
137144
else
@@ -164,4 +171,7 @@ echoConstants() {
164171
}
165172
# echoConstants
166173
initVersion
174+
if [[ $1 == '-y' ]]; then
175+
echo "'-y' argument passed, will install from source if required"
176+
fi
167177
initInstall

0 commit comments

Comments
 (0)