Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install script now shows repositories and version numbers #968

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 93 additions & 40 deletions etc/dbus-serialbattery/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,84 @@
# remove comment for easier troubleshooting
#set -x

echo ""

echo
# fetch version numbers for different versions
echo -n "Fetch current version numbers..."

# louisvdw stable
latest_release_louisvdw_stable=$(curl -s https://api.github.com/repos/Louisvdw/dbus-serialbattery/releases/latest | grep "tag_name" | cut -d : -f 2,3 | tr -d "\ " | tr -d \" | tr -d \,)

# louisvdw beta
latest_release_louisvdw_beta=$(curl -s https://api.github.com/repos/Louisvdw/dbus-serialbattery/releases | grep "tag_name.*beta" | cut -d : -f 2,3 | tr -d "\ " | tr -d \" | tr -d \, | head -n 1)

# louisvdw dev
latest_release_louisvdw_dev=$(curl -s https://raw.githubusercontent.com/Louisvdw/dbus-serialbattery/dev/etc/dbus-serialbattery/utils.py | grep DRIVER_VERSION | awk -F'"' '{print "v" $2}')

# mr-manuel stable
latest_release_mrmanuel_stable=$(curl -s https://api.github.com/repos/mr-manuel/venus-os_dbus-serialbattery/releases/latest | grep "tag_name" | cut -d : -f 2,3 | tr -d "\ " | tr -d \" | tr -d \,)

# mr-manuel beta
latest_release_mrmanuel_beta=$(curl -s https://api.github.com/repos/mr-manuel/venus-os_dbus-serialbattery/releases | grep "tag_name.*beta" | cut -d : -f 2,3 | tr -d "\ " | tr -d \" | tr -d \, | head -n 1)

# mr-manuel dev
latest_release_mrmanuel_dev=$(curl -s https://raw.githubusercontent.com/mr-manuel/venus-os_dbus-serialbattery/dev/etc/dbus-serialbattery/utils.py | grep DRIVER_VERSION | awk -F'"' '{print "v" $2}')

# done
echo " done."



echo
PS3="Select which version you want to install and enter the corresponding number [1]: "

select version in "latest release (recommended)" "specific version" "nightly build" "local tar file" "quit"
# create list of versions
version_list=(
"latest release \"$latest_release_louisvdw_stable\" (louisvdw's repo, stable)"
"latest release \"$latest_release_mrmanuel_stable\" (mr-manuel's repo, stable, most up to date)"
"beta build \"$latest_release_louisvdw_beta\" (louisvdw's repo)"
"beta build \"$latest_release_mrmanuel_beta\" (mr-manuel's repo, no errors after 72 h runtime, long time testing needed)"
"dev build \"$latest_release_louisvdw_dev\" (louisvdw's repo)"
"dev build \"$latest_release_mrmanuel_dev\" (mr-manuel's repo, newest features and fixes, bugs possible)"
"specific version"
"local tar file"
"quit"
)

select version in "${version_list[@]}"
do
case $version in
"latest release (recommended)")
"latest release \"$latest_release_louisvdw_stable\" (louisvdw's repo, stable)")
echo "Selected: $version"
#echo "Selected number: $REPLY"
break
;;
"specific version")
"latest release \"$latest_release_mrmanuel_stable\" (mr-manuel's repo, stable, most up to date)")
echo "Selected: $version"
#echo "Selected number: $REPLY"
break
;;
"beta build \"$latest_release_louisvdw_beta\" (louisvdw's repo)")
echo "Selected: $version"
#echo "Selected number: $REPLY"
break
;;
"beta build \"$latest_release_mrmanuel_beta\" (mr-manuel's repo, no errors after 72 h runtime, long time testing needed)")
echo "Selected: $version"
#echo "Selected number: $REPLY"
break
;;
"dev build \"$latest_release_louisvdw_dev\" (louisvdw's repo)")
echo "Selected: $version"
#echo "Selected number: $REPLY"
break
;;
"nightly build")
"dev build \"$latest_release_mrmanuel_dev\" (mr-manuel's repo, newest features and fixes, bugs possible)")
echo "Selected: $version"
#echo "Selected number: $REPLY"
break
;;
"specific version")
echo "Selected: $version"
#echo "Selected number: $REPLY"
break
Expand All @@ -40,12 +101,32 @@ do
done
echo ""



## latest release
if [ "$version" = "latest release (recommended)" ]; then
if [ "$version" = "latest release \"$latest_release_louisvdw_stable\" (louisvdw's repo, stable)" ]; then
# download latest release
curl -s https://api.github.com/repos/Louisvdw/dbus-serialbattery/releases/latest | grep "browser_download_url.*gz" | cut -d : -f 2,3 | tr -d \" | wget -O /tmp/venus-data.tar.gz -qi -
fi

## latest release (mr-manuel, most up to date)
if [ "$version" = "latest release \"$latest_release_mrmanuel_stable\" (mr-manuel's repo, stable, most up to date)" ]; then
# download latest release
curl -s https://api.github.com/repos/mr-manuel/venus-os_dbus-serialbattery/releases/latest | grep "browser_download_url.*gz" | cut -d : -f 2,3 | tr -d \" | wget -O /tmp/venus-data.tar.gz -qi -
fi

## beta release
if [ "$version" = "beta build \"$latest_release_louisvdw_beta\" (louisvdw's repo)" ]; then
# download beta release
curl -s https://api.github.com/repos/Louisvdw/dbus-serialbattery/releases/tags/$latest_release_louisvdw_beta | grep "browser_download_url.*gz" | cut -d : -f 2,3 | tr -d \" | wget -O /tmp/venus-data.tar.gz -qi -
fi

## beta release (mr-manuel, most up to date)
if [ "$version" = "beta build \"$latest_release_mrmanuel_beta\" (mr-manuel's repo, no errors after 72 h runtime, long time testing needed)" ]; then
# download beta release
curl -s https://api.github.com/repos/mr-manuel/venus-os_dbus-serialbattery/releases/tags/$latest_release_mrmanuel_beta | grep "browser_download_url.*gz" | cut -d : -f 2,3 | tr -d \" | wget -O /tmp/venus-data.tar.gz -qi -
fi

## specific version
if [ "$version" = "specific version" ]; then
# read the url
Expand All @@ -70,7 +151,7 @@ fi


## extract the tar file
if [ "$version" = "latest release (recommended)" ] || [ "$version" = "specific version" ] || [ "$version" = "local tar file" ]; then
if [ "$version" = "latest release \"$latest_release_louisvdw_stable\" (louisvdw's repo, stable)" ] || [ "$version" = "latest release \"$latest_release_mrmanuel_stable\" (mr-manuel's repo, stable, most up to date)" ] || [ "$version" = "beta build \"$latest_release_louisvdw_beta\" (louisvdw's repo)" ] || [ "$version" = "beta build \"$latest_release_mrmanuel_beta\" (mr-manuel's repo, no errors after 72 h runtime, long time testing needed)" ] || [ "$version" = "specific version" ] || [ "$version" = "local tar file" ]; then

# extract driver
if [ -f "/tmp/venus-data.tar.gz" ]; then
Expand All @@ -89,43 +170,15 @@ if [ "$version" = "latest release (recommended)" ] || [ "$version" = "specific v
fi


## nightly build
if [ "$version" = "nightly build" ]; then

PS3="Select the branch from wich you want to install the current code (possible bugs included): "

select branch in "master" "dev" "dev (mr-manuel's repo)" "quit"
do
case $branch in
"master")
echo "Selected branch: $branch"
#echo "Selected number: $REPLY"
break
;;
"dev")
echo "Selected branch: $branch"
#echo "Selected number: $REPLY"
break
;;
"dev (mr-manuel's repo)")
echo "Selected branch: $branch"
#echo "Selected number: $REPLY"
break
;;
"quit")
exit 0
;;
*)
echo "Invalid option $REPLY"
;;
esac
done

## dev builds
if [ "$version" = "dev build \"$latest_release_louisvdw_dev\" (louisvdw's repo)" ] || [ "$version" = "dev build \"$latest_release_mrmanuel_dev\" (mr-manuel's repo, newest features and fixes, bugs possible)" ]; then

branch="dev"

cd /tmp

if [ "$branch" = "dev (mr-manuel's repo)" ]; then
branch="dev"
if [ "$version" = "dev build \"$latest_release_mrmanuel_dev\" (mr-manuel's repo, newest features and fixes, bugs possible)" ]; then

# clean already extracted folder
rm -rf /tmp/venus-os_dbus-serialbattery-$branch
Expand Down