Skip to content

Commit

Permalink
generic WIP - generic bash
Browse files Browse the repository at this point in the history
  • Loading branch information
froger-me committed Jan 8, 2024
1 parent 9df8d9d commit 590ce45
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 75 deletions.
102 changes: 89 additions & 13 deletions integration/dummy-generic/dummy-generic.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,99 @@
#!/bin/bash
version="1.4.14"

# get_version function
function get_version() {
echo "$version"
}
### INSTALLING THE PACKAGE ###

if [ "$1" == "get_version" ]; then
# install the package
get_version
if [ "$1" == "install" ] && [ "$(bash "$(dirname "$0")/wppus-api.sh" is_installed)" == "false" ] && [ "$2" != "" ]; then
bash "$(dirname "$0")/wppus-api.sh" install $2
echo "Installed"
# halt the script
exit 0
elif [ "$1" == "install" ]; then
echo "Failed to install"
# halt the script
exit 1
fi

### INSTALLING THE PACKAGE IF NECESSARY ###
### UNINSTALLING THE PACKAGE ###

if [ "$(bash "$(dirname "$0")/wppus-api.sh" is_installed)" == "false" ]; then
bash "$(dirname "$0")/wppus-api.sh" install
if [ "$1" == "uninstall" ] && [ "$(bash "$(dirname "$0")/wppus-api.sh" is_installed)" == "true" ]; then
# uninstall the package
bash "$(dirname "$0")/wppus-api.sh" uninstall
echo "Uninstalled"
# halt the script
exit 0
elif [ "$1" == "uninstall" ]; then
echo "Nothing to uninstall"
# halt the script
exit 1
fi

### PACKAGE EXECUTION ###
echo "Hello"
### ACTIVATING THE LICENSE ###

if [ "$1" == "activate" ] && [ "$(bash "$(dirname "$0")/wppus-api.sh" is_installed)" == "true" ]; then
# activate the license
bash "$(dirname "$0")/wppus-api.sh" activate
echo "Activated"
# halt the script
exit 0
elif [ "$1" == "activate" ]; then
echo "The package is not installed"
# halt the script
exit 1
fi

### DEACTIVATING THE LICENSE ###

if [ "$1" == "deactivate" ] && [ "$(bash "$(dirname "$0")/wppus-api.sh" is_installed)" == "true" ]; then
# activate the license
bash "$(dirname "$0")/wppus-api.sh" deactivate
echo "Deactivated"
# halt the script
exit 0
elif [ "$1" == "deactivate" ]; then
echo "The package is not installed"
# halt the script
exit 1
fi

### GETTING UPDATE INFORMATION ###

if [ "$1" == "get_update_info" ] && [ "$(bash "$(dirname "$0")/wppus-api.sh" is_installed)" == "true" ]; then
# get the update information
bash "$(dirname "$0")/wppus-api.sh" get_update_info
# halt the script
exit 0
elif [ "$1" == "get_update_info" ]; then
echo "The package is not installed"
# halt the script
exit 1
fi

### UPDATING THE PACKAGE ###

if [ "$1" == "update" ] && [ "$(bash "$(dirname "$0")/wppus-api.sh" is_installed)" == "true" ]; then
# update the package
bash "$(dirname "$0")/wppus-api.sh" check_for_updates
echo "Updated"
echo ""
bash "$(dirname "$0")/wppus-api.sh" get_update_info
# halt the script
exit 0
elif [ "$1" == "update" ]; then
echo "The package is not installed"
# halt the script
exit 1
fi

### USAGE ###

echo "Usage: bash \"$(dirname "$0")/wppus-api.sh\" [command] [arguments]"
echo "Commands:"
echo " install [license] - install the package"
echo " uninstall - uninstall the package"
echo " activate - activate the license"
echo " deactivate - deactivate the license"
echo " get_update_info - output information about the remote package update"
echo " update - update the package if available"
echo "Installing the package will register a cronjob that will check for updates every 12 hours, and will install the update if available."
# halt the script
exit 1
Loading

0 comments on commit 590ce45

Please sign in to comment.