├── demo └── gam.gif ├── README.md ├── gam └── LICENSE.md /demo/gam.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fmstrat/gam/HEAD/demo/gam.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Application Manager 2 | 3 | A linux tool similar to `apt` and `yum` that is used to search for and install applications from GitHub. Works on many different application types that are stored in repos as releases, including: 4 | - deb 5 | - rpm 6 | - AppImage 7 | - Electron (tar/gz) 8 | 9 | `gam` will automatically add a command to your `PATH` and if GNOME is installed it will add a shortcut to the application as well. These are automatically removed when uninstalling applications. 10 | 11 | ***Proud to have made the top spot on [r/github](https://www.reddit.com/r/github) and [r/coolgithubprojects](https://www.reddit.com/r/coolgithubprojects) on launch day.*** 12 | 13 | ![demo](demo/gam.gif) 14 | 15 | ## Documentation 16 | 17 | Latest documentation available at: [https://nowsci.com/gam/](https://nowsci.com/gam/) 18 | -------------------------------------------------------------------------------- /gam: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Prerequisites 4 | # ============= 5 | # 6 | ## CentOS 7 | ## ------ 8 | ## yum install -y ncurses which jq curl tar 9 | # 10 | ## Debian/Ubuntu 11 | ## ------------- 12 | ## apt install -y ncurses-bin debianutils jq curl tar xz-utils 13 | # 14 | 15 | RETURN=0 16 | RELEASE=v1.3 17 | 18 | { 19 | 20 | function usage() { 21 | echo 'Usage: 22 | gam list # List installed applications 23 | gam search # Get a list of repos that match a search string 24 | gam install # Install one or more applications 25 | gam check [] # Check currently installed applications for updates 26 | gam upgrade [] # Upgrade one, more, or all currently installed applications 27 | gam remove # Remove one or more applications 28 | gam create-config # Create initial configuration 29 | gam update # Update your version of gam 30 | 31 | Optional paramaters: 32 | -i|--include [--include ] 33 | # If more than one asset is matched during an install, use the --include flag to match 34 | # the asset with the include string. Every include string must match to be considered 35 | # for install. 36 | 37 | -e|--exclude [--exclude ] 38 | # If more than one asset is matched during an install, use the --exclude flag to not 39 | # match any assets with the excluded string. Every exclude string must not match to be 40 | # considered for install. 41 | 42 | -u:--user 43 | # Run in rootless user mode with a ~/.config/gam/gam.conf configuration, executables in, 44 | # ~/bin (by default), and no support for rpm or deb files. 45 | 46 | -a|--allow-pre-release 47 | # Allow inclusion of pre-releases 48 | 49 | -d|--debug 50 | # Debug mode to show what is happening behind the scenes.' 51 | exit 52 | } 53 | 54 | if [ -z "${1}" ]; then 55 | usage 56 | fi 57 | 58 | COMMAND="${1}" 59 | shift; 60 | 61 | # Parse the command line 62 | COUNTER=0 63 | APPLICATIONS=() 64 | INCLUDES=() 65 | EXCLUDES=() 66 | while [[ $# -gt 0 ]]; do 67 | KEY="${1}" 68 | if [[ "${KEY}" = "-"* ]]; then 69 | case $KEY in 70 | -i|--include) 71 | export INCLUDES+=("${2}") 72 | shift # past argument 73 | shift # past value 74 | ;; 75 | -e|--exclude) 76 | export EXCLUDES+=("${2}") 77 | shift # past argument 78 | shift # past value 79 | ;; 80 | -u|--user) 81 | export USER_MODE=true 82 | shift # past argument 83 | ;; 84 | -d|--debug) 85 | export GAM_DEBUG=true 86 | shift # past argument 87 | ;; 88 | -a|--allow-pre-release) 89 | export ALLOW_PRERELEASE=true 90 | shift # past argument 91 | ;; 92 | *) 93 | usage 94 | ;; 95 | esac 96 | else 97 | APPLICATIONS+=("${KEY,,}") 98 | shift 99 | fi 100 | if [ $((COUNTER++)) -eq 100 ]; then 101 | usage 102 | fi 103 | done 104 | 105 | if [ -n "${GAM_DEBUG}" ]; then 106 | set -x 107 | fi 108 | 109 | function checkAPILimit() { 110 | if [ -n "$(grep '"message":"API rate limit exceeded' ${1})" ]; then 111 | printf "${RED}[!]${NORMAL} GitHub API limit exceeded, see ${BOLD}https://github.com/Fmstrat/gam#github-api-limits${NORMAL}\n" 112 | rm -f "${1}" 113 | exit 1 114 | fi 115 | } 116 | 117 | function checkName() { 118 | RET=false 119 | if [[ "${1}" = *".AppImage" ]]; then 120 | RET=AppImage 121 | elif [[ "${1}" = *".tar.xz" ]]; then 122 | RET=tar.xz 123 | elif [[ "${1}" = *".tar.gz" ]] || [[ "${1}" = *".tgz" ]]; then 124 | RET=tgz 125 | elif [ -z "${USER_MODE}" ] && [[ "${1}" = *".deb" ]] && [ "${PACKAGE_MANAGER}" = "deb" ]; then 126 | RET=deb 127 | elif [ -z "${USER_MODE}" ] && [[ "${1}" = *".rpm" ]] && [ "${PACKAGE_MANAGER}" = "rpm" ]; then 128 | RET=rpm 129 | fi 130 | echo ${RET} 131 | } 132 | 133 | function checkMatch() { 134 | RET=false 135 | INCLUDE_COUNTER=0 136 | for INCLUDE in ${INCLUDES[@]}; do 137 | if [[ "${1}" = *"${INCLUDE}"* ]]; then 138 | INCLUDE_COUNTER=$((INCLUDE_COUNTER+1)) 139 | fi 140 | done 141 | if [ ${INCLUDE_COUNTER} -eq ${#INCLUDES[@]} ]; then 142 | RET=true 143 | fi 144 | EXCLUDE_COUNTER=0 145 | for EXCLUDE in ${EXCLUDES[@]}; do 146 | if [[ "${1}" = *"${EXCLUDE}"* ]]; then 147 | EXCLUDE_COUNTER=$((EXCLUDE_COUNTER+1)) 148 | fi 149 | done 150 | if [ ${EXCLUDE_COUNTER} -gt 0 ]; then 151 | RET=false 152 | fi 153 | echo ${RET} 154 | } 155 | 156 | function setVersion() { 157 | VERSION="${1}" 158 | V_FOLDER="${2}" 159 | V_NAME=${V_FOLDER##${INSTALL_FOLDER}/} 160 | echo "${VERSION}" | tee "${INSTALL_FOLDER}/${V_FOLDER}/VERSION" > /dev/null 161 | echo "${INCLUDES[@]}" | tee "${INSTALL_FOLDER}/${V_FOLDER}/INCLUDES" > /dev/null 162 | echo "${EXCLUDES[@]}" | tee "${INSTALL_FOLDER}/${V_FOLDER}/EXCLUDES" > /dev/null 163 | printf "${GREEN}[:]${NORMAL} Version ${BOLD}${VERSION}${NORMAL} of ${BOLD}%s${NORMAL} installed in ${BOLD}%s${NORMAL}.\n" "${V_NAME}" "${INSTALL_FOLDER}/${V_FOLDER}" 164 | } 165 | 166 | function setDescription() { 167 | D_DESCRIPTION="${1}" 168 | D_FOLDER="${2}" 169 | echo "${D_DESCRIPTION}" | tee "${INSTALL_FOLDER}/${D_FOLDER}/DESCRIPTION" > /dev/null 170 | } 171 | 172 | function gnomeMenu() { 173 | if [ -d ${SHORTCUT_FOLDER} ]; then 174 | NAME="${1}" 175 | FOLDER="${2}" 176 | EXE="${3}" 177 | ICON="${4}" 178 | NAME=$(echo "${NAME}" | sed 's/[-_]/ /g;s/\b\(.\)/\u\1/g') 179 | SHORTCUT=$(echo "${FOLDER}" | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]') 180 | SHORTCUT="${SHORTCUT_FOLDER}/${SHORTCUT}.desktop" 181 | echo "[Desktop Entry] 182 | Name=${NAME} 183 | Exec=${EXE} 184 | Terminal=false 185 | Icon=${ICON} 186 | Type=Application 187 | GenericName=${NAME} 188 | Comment=${NAME}" | tee "${SHORTCUT}" > /dev/null 189 | fi 190 | } 191 | 192 | function symLink() { 193 | S_FOLDER=${1} 194 | S_EXE=${2} 195 | S_AUTHOR=${S_FOLDER%%/*} 196 | S_APP=${S_FOLDER##*/} 197 | S_ALT_APP=${S_APP}-${S_AUTHOR} 198 | if [ -f "${BIN_FOLDER}/${S_APP}" ]; then 199 | if [ -f "${BIN_FOLDER}/${S_ALT_APP}" ]; then 200 | printf "${RED}[!]${NORMAL} ${BOLD}/bin/%s${NORMAL} and ${BOLD}${BIN_FOLDER}/%s${NORMAL} already exist, cannot make symlink.\n" "${S_APP}" "${S_ALT_APP}" 201 | else 202 | printf "${YELLOW}[:]${NORMAL} ${BOLD}${BIN_FOLDER}/%s${NORMAL} already exists, using ${BOLD}${BIN_FOLDER}/%s${NORMAL} instead.\n" "${S_APP}" "${S_ALT_APP}" 203 | if [ -L "${BIN_FOLDER}/${S_ALT_APP}" ]; then 204 | rm -f "${BIN_FOLDER}/${S_ALT_APP}" 205 | fi 206 | ln -s "${S_EXE}" "${BIN_FOLDER}/${S_ALT_APP}" 207 | fi 208 | else 209 | if [ -L "${BIN_FOLDER}/${S_APP}" ]; then 210 | rm -f "${BIN_FOLDER}/${S_APP}" 211 | fi 212 | ln -s "${S_EXE}" "${BIN_FOLDER}/${S_APP}" 213 | fi 214 | } 215 | 216 | function installAppImage() { 217 | NAME="${1}" 218 | FILE="${2}" 219 | FOLDER="${3}" 220 | TMPFOLDER="${TMP_FOLDER}/assets/extract/${FOLDER}" 221 | rm -rf ${TMP_FOLDER}/assets/extract/* 222 | mkdir -p "${TMPFOLDER}" 223 | cd "${TMPFOLDER}" 224 | chmod 755 "${TMP_FOLDER}/assets/${FILE}" 225 | "${TMP_FOLDER}/assets/${FILE}" --appimage-extract > /dev/null 226 | ICONSRC=$(ls -S "${TMPFOLDER}/squashfs-root/"*"-icon."* 2>/dev/null |head -n1) 227 | if [ -z "${ICONSRC}" ]; then 228 | ICONSRC=$(find "${TMPFOLDER}/squashfs-root/" -type f \( -iname *.png -o -iname *.jpg -o -iname *.gif \) -print0 | xargs -0 ls -S |grep icon |head -n1) 229 | fi 230 | ICON="${INSTALL_FOLDER}/${FOLDER}/${ICONSRC##*/}" 231 | rm -rf "${INSTALL_FOLDER}/${FOLDER}" 232 | mkdir -p "${INSTALL_FOLDER}/${FOLDER}/app" 233 | mv "${ICONSRC}" "${ICON}" 234 | if [ -z "${USER_MODE}" ]; then 235 | chown root:root "${ICON}" 236 | chown root:root "${TMP_FOLDER}/assets/${FILE}" 237 | fi 238 | cd - > /dev/null 239 | rm -rf ${TMP_FOLDER}/assets/extract/* 240 | mv "${TMP_FOLDER}/assets/${FILE}" "${INSTALL_FOLDER}/${FOLDER}/app/" 241 | EXE="${INSTALL_FOLDER}/${FOLDER}/app/${FILE}" 242 | setVersion "${VERSION}" "${FOLDER}" 243 | setDescription "${DESCRIPTION}" "${FOLDER}" 244 | gnomeMenu "${NAME}" "${FOLDER}" "${EXE}" "${ICON}" 245 | symLink "${FOLDER}" "${EXE}" 246 | } 247 | 248 | function installArchive() { 249 | TYPE="${1}" 250 | NAME="${2}" 251 | FILE="${3}" 252 | FOLDER="${4}" 253 | TMPFOLDER="${TMP_FOLDER}/assets/extract/${FOLDER}" 254 | rm -rf ${TMP_FOLDER}/assets/extract/* 255 | mkdir -p "${TMPFOLDER}" 256 | if [ "${TYPE}" = "tar.xz" ]; then 257 | tar xf "${TMP_FOLDER}/assets/${FILE}" -C "${TMPFOLDER}" --strip-components 1 258 | else 259 | tar xfz "${TMP_FOLDER}/assets/${FILE}" -C "${TMPFOLDER}" --strip-components 1 260 | fi 261 | rm -rf "${TMP_FOLDER}/assets/${FILE}" 262 | if [ -f "${TMPFOLDER}/v8_context_snapshot.bin" ]; then 263 | # electron 264 | AUTHOR=${FOLDER%%/*} 265 | APP=${FOLDER##*/} 266 | if [ -z "${USER_MODE}" ]; then 267 | chown root:root "${TMP_FOLDER}/assets/extract/${AUTHOR}" -R 268 | fi 269 | rm -rf "${INSTALL_FOLDER}/${FOLDER}" 270 | mkdir -p "${INSTALL_FOLDER}/${FOLDER}" 271 | mv "${TMPFOLDER}" "${INSTALL_FOLDER}/${FOLDER}/app" 272 | ICON=$(find "${INSTALL_FOLDER}/${FOLDER}/app" -type f \( -iname *.png -o -iname *.jpg -o -iname *.gif \) -print0 | xargs -0 ls -S |grep icon |head -n1) 273 | EXE=$(find "${INSTALL_FOLDER}/${FOLDER}/app" -maxdepth 1 -type f -executable -print0 | xargs -0 ls -S |head -n1) 274 | setVersion "${VERSION}" "${FOLDER}" 275 | setDescription "${DESCRIPTION}" "${FOLDER}" 276 | gnomeMenu "${NAME}" "${FOLDER}" "${EXE}" "${ICON}" 277 | symLink "${FOLDER}" "${EXE}" 278 | fi 279 | rm -rf ${TMP_FOLDER}/assets/extract/* 280 | } 281 | 282 | function installDeb() { 283 | NAME="${1}" 284 | FILE="${2}" 285 | FOLDER="${3}" 286 | DEB="${TMP_FOLDER}/assets/${FILE}" 287 | dpkg -i "${TMP_FOLDER}/assets/${FILE}" 288 | mkdir -p "${INSTALL_FOLDER}/${FOLDER}/app" 289 | PACKAGE=$(dpkg -I "${TMP_FOLDER}/assets/${FILE}" |grep "Package:") 290 | PACKAGE=${PACKAGE#*: } 291 | echo "${PACKAGE}" | tee "${INSTALL_FOLDER}/${FOLDER}/app/DEB" >/dev/null 292 | rm "${TMP_FOLDER}/assets/${FILE}" 293 | setVersion "${VERSION}" "${FOLDER}" 294 | setDescription "${DESCRIPTION}" "${FOLDER}" 295 | } 296 | 297 | function installRpm() { 298 | NAME="${1}" 299 | FILE="${2}" 300 | FOLDER="${3}" 301 | RPM="${TMP_FOLDER}/assets/${FILE}" 302 | rpm -Uvh "${TMP_FOLDER}/assets/${FILE}" 303 | mkdir -p "${INSTALL_FOLDER}/${FOLDER}/app" 304 | PACKAGE=$(rpm -qp --queryformat "%{NAME}" "${TMP_FOLDER}/assets/${FILE}" 2>/dev/null) 305 | echo "${PACKAGE}" | tee "${INSTALL_FOLDER}/${FOLDER}/app/RPM" >/dev/null 306 | rm "${TMP_FOLDER}/assets/${FILE}" 307 | setVersion "${VERSION}" "${FOLDER}" 308 | setDescription "${DESCRIPTION}" "${FOLDER}" 309 | } 310 | 311 | function checkRoot() { 312 | if [ -z "${USER_MODE}" ] && (( $(id -u) != 0 )); then 313 | printf "${RED}[!]${NORMAL} This command must be ran as root.\n" 314 | exit 315 | fi 316 | } 317 | 318 | function installAsset() { 319 | FILE="${1}" 320 | VERSION="${2}" 321 | URL="${3}" 322 | FOLDER="${URL%%/releases*}" 323 | FOLDER="${FOLDER##*github.com/}" 324 | NAME="${FOLDER##*/}" 325 | FOLDER="${FOLDER,,}" 326 | if [ -f "${INSTALL_FOLDER}/${FOLDER}/VERSION" ]; then 327 | CURVERSION=$(cat "${INSTALL_FOLDER}/${FOLDER}/VERSION") 328 | if [ -z "${CHECK_ONLY}" ]; then 329 | if [ "${CURVERSION}" = "${VERSION}" ]; then 330 | FULL_NAME=${FOLDER##${INSTALL_FOLDER}/} 331 | printf "${YELLOW}[:]${NORMAL} Version ${BOLD}${VERSION}${NORMAL} of ${BOLD}%s${NORMAL} already installed in ${BOLD}%s${NORMAL}.\n" "${FULL_NAME}" "${INSTALL_FOLDER}/${FOLDER}" 332 | return 333 | fi 334 | else 335 | if [ "${CURVERSION}" = "${VERSION}" ]; then 336 | FULL_NAME=${FOLDER##${INSTALL_FOLDER}/} 337 | printf "${GREEN}[:]${NORMAL} ${BOLD}${FULL_NAME}${NORMAL}:${BOLD}${VERSION}${NORMAL} is the latest.\n" 338 | return 339 | else 340 | FULL_NAME=${FOLDER##${INSTALL_FOLDER}/} 341 | printf "${YELLOW}[:]${NORMAL} ${BOLD}${FULL_NAME}${NORMAL}:${BOLD}${VERSION}${NORMAL} is newer than the installed ${BOLD}${CURVERSION}${NORMAL}.\n" 342 | RETURN=133 343 | return 344 | fi 345 | fi 346 | fi 347 | if [ -z "${CHECK_ONLY}" ]; then 348 | ${CURL} -L "${URL}" -o "${TMP_FOLDER}/assets/${FILE}" 349 | case "$(checkName ${FILE})" in 350 | AppImage) 351 | installAppImage "${NAME}" "${FILE}" "${FOLDER}" 352 | ;; 353 | tar.xz) 354 | installArchive "tar.xz" "${NAME}" "${FILE}" "${FOLDER}" 355 | ;; 356 | tgz) 357 | installArchive "tgz" "${NAME}" "${FILE}" "${FOLDER}" 358 | ;; 359 | deb) 360 | installDeb "${NAME}" "${FILE}" "${FOLDER}" 361 | ;; 362 | rpm) 363 | installRpm "${NAME}" "${FILE}" "${FOLDER}" 364 | ;; 365 | esac 366 | fi 367 | } 368 | 369 | function getDescription() { 370 | DESCRIPTION=$(echo ${1} | jq -r '.description') 371 | FORK=$(echo ${1} | jq -r '.fork') 372 | if [ "${DESCRIPTION}" = "null" ]; then 373 | DESCRIPTION="" 374 | fi 375 | if [ "${FORK}" != "false" ]; then 376 | DESCRIPTION="[fork] ${DESCRIPTION}" 377 | fi 378 | echo "${DESCRIPTION}" 379 | } 380 | 381 | function gamSearch() { 382 | if (( ${#APPLICATIONS[@]} != 1 )); then 383 | usage 384 | fi 385 | NAMES=() 386 | DESCRIPTIONS=() 387 | MAXLENGTH=0 388 | CACHE=$(echo "${APPLICATIONS[0]}" | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]') 389 | if [ ! -f "${TMP_FOLDER}/cache/search/${CACHE}" ] || [ $(find "${TMP_FOLDER}/cache/search/${CACHE}" -mmin +10 | egrep '.*') ]; then 390 | ${CURL} -s "https://api.github.com/search/repositories?q=${APPLICATIONS[0]}" -o "${TMP_FOLDER}/cache/search/${CACHE}" 391 | checkAPILimit "${TMP_FOLDER}/cache/search/${CACHE}" 392 | fi 393 | JSON=$(cat "${TMP_FOLDER}/cache/search/${CACHE}") 394 | for ITEM in $(echo ${JSON} | jq -r '.items[] | @base64'); do 395 | ITEM=$(echo ${ITEM} | base64 -d) 396 | NAME=$(echo ${ITEM} | jq -r '.full_name') 397 | DESCRIPTION=$(getDescription "${ITEM}") 398 | NAMES+=("${NAME}") 399 | DESCRIPTIONS+=("${DESCRIPTION}") 400 | if [ ${#NAME} -gt ${MAXLENGTH} ]; then 401 | MAXLENGTH=${#NAME} 402 | fi 403 | done 404 | DESCLENGTH=$(( COLS - MAXLENGTH - 6 )) 405 | DESCTRUNC=$(( DESCLENGTH - 3 )) 406 | for I in ${!NAMES[@]}; do 407 | DESCRIPTION="${DESCRIPTIONS[$I]}" 408 | if [ ${#DESCRIPTION} -gt ${DESCLENGTH} ]; then 409 | DESCRIPTION="${DESCRIPTION:0:${DESCTRUNC}}..." 410 | fi 411 | printf "${GREEN}%-${MAXLENGTH}s ${NORMAL}${DIM}| ${NORMAL}%s\n" "${NAMES[$I]}" "${DESCRIPTION}" 412 | done 413 | } 414 | 415 | function gamVersionCheck() { 416 | if [ ! -f "${TMP_FOLDER}/cache/version" ] || [ $(find "${TMP_FOLDER}/cache/version" -mmin +1440 | egrep '.*') ]; then 417 | ${CURL} -s "https://api.github.com/repos/fmstrat/gam/releases/latest" -o "${TMP_FOLDER}/cache/version" 418 | checkAPILimit "${TMP_FOLDER}/cache/version" 419 | fi 420 | JSON=$(cat "${TMP_FOLDER}/cache/version") 421 | VERSION=$(echo ${JSON} | jq -r '.tag_name') 422 | if [ "${VERSION}" != "${RELEASE}" ]; then 423 | printf "${YELLOW}[:]${NORMAL} A new version of ${BOLD}gam${NORMAL} is available. Install with ${BOLD}gam update${NORMAL}.\n" 424 | fi 425 | } 426 | 427 | function gamInstall() { 428 | for APPLICATION in ${APPLICATIONS[@]}; do 429 | NAMES=() 430 | VERSIONS=() 431 | URLS=() 432 | MAXLENGTH=0 433 | CACHE=$(echo "${APPLICATION}" | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]') 434 | INFO_CACHE=$(echo "${APPLICATION}" | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]').info 435 | if [ ! -f "${TMP_FOLDER}/cache/releases/${CACHE}" ] || [ $(find "${TMP_FOLDER}/cache/releases/${CACHE}" -mmin +10 | egrep '.*') ]; then 436 | ${CURL} -s "https://api.github.com/repos/${APPLICATION}/releases" -o "${TMP_FOLDER}/cache/releases/${CACHE}" 437 | checkAPILimit "${TMP_FOLDER}/cache/releases/${CACHE}" 438 | fi 439 | if [ ! -f "${TMP_FOLDER}/cache/releases/${INFO_CACHE}" ] || [ $(find "${TMP_FOLDER}/cache/releases/${INFO_CACHE}" -mmin +10 | egrep '.*') ]; then 440 | ${CURL} -s "https://api.github.com/repos/${APPLICATION}" -o "${TMP_FOLDER}/cache/releases/${INFO_CACHE}" 441 | checkAPILimit "${TMP_FOLDER}/cache/releases/${INFO_CACHE}" 442 | fi 443 | if [ -n "$(grep '"message": "Not Found"' "${TMP_FOLDER}/cache/releases/${INFO_CACHE}")" ]; then 444 | printf "${RED}[!]${NORMAL} No repo found for ${BOLD}%s${NORMAL}.\n" "${APPLICATION}" 445 | break 446 | fi 447 | JSON=$(cat "${TMP_FOLDER}/cache/releases/${CACHE}") 448 | INFO_JSON=$(cat "${TMP_FOLDER}/cache/releases/${CACHE}.info") 449 | DESCRIPTION=$(getDescription "${INFO_JSON}") 450 | SELECT=".draft == false and .prerelease == false" 451 | if [ -n "${ALLOW_PRERELEASE}" ]; then 452 | SELECT=".draft == false" 453 | fi 454 | for ASSET in $(echo ${JSON} | jq -r ".[] | select(${SELECT}) | @base64"); do 455 | ASSET=$(echo ${ASSET} | base64 -d) 456 | VERSION=$(echo ${ASSET} | jq -r '.tag_name') 457 | for ITEM in $(echo ${ASSET} | jq -r '.assets[] | @base64'); do 458 | ITEM=$(echo ${ITEM} | base64 -d) 459 | NAME=$(echo ${ITEM} | jq -r '.name') 460 | URL=$(echo ${ITEM} | jq -r '.browser_download_url') 461 | if [ $(checkName "${NAME}") != "false" ]; then 462 | NAMES+=("${NAME}") 463 | VERSIONS+=("${VERSION}") 464 | URLS+=("${URL}") 465 | fi 466 | done 467 | break 468 | done 469 | if (( ${#NAMES[@]} == 0 )); then 470 | printf "${RED}[!]${NORMAL} No releases or assets were found for ${BOLD}%s${NORMAL}.\n" "${APPLICATION}" 471 | elif (( ${#NAMES[@]} == 1 )); then 472 | installAsset "${NAMES[0]}" "${VERSIONS[0]}" "${URLS[0]}" 473 | else 474 | COUNTER=0 475 | SELECTED="" 476 | INCLUDE_NAMES=() 477 | for I in ${!NAMES[@]}; do 478 | if [ $(checkMatch "${NAMES[$I]}") != "false" ]; then 479 | SELECTED=${I} 480 | INCLUDE_NAMES+=("${NAMES[$I]}") 481 | COUNTER=$((COUNTER+1)) 482 | fi 483 | done 484 | if [ ${COUNTER} -gt 1 ] || [ -z "${SELECTED}" ]; then 485 | if [ ${#INCLUDES[@]} -eq 0 ]; then 486 | printf "${RED}[!]${NORMAL} Multiple assets were found for ${BOLD}%s${NORMAL}. You must use the --include/exclude flags. See usage for help.\n" "${APPLICATION}" 487 | for N in ${NAMES[@]}; do 488 | printf " ${BOLD}-${NORMAL} %s\n" "${N}" 489 | done 490 | else 491 | printf "${RED}[!]${NORMAL} Multiple assets were found for ${BOLD}%s${NORMAL} and the match specified. See usage for help.\n" "${APPLICATION}" 492 | for N in ${INCLUDE_NAMES[@]}; do 493 | printf " ${BOLD}-${NORMAL} %s\n" "${N}" 494 | done 495 | fi 496 | else 497 | installAsset "${NAMES[$SELECTED]}" "${VERSIONS[$SELECTED]}" "${URLS[$SELECTED]}" 498 | fi 499 | fi 500 | done 501 | } 502 | 503 | function gamUpgrade() { 504 | if [ ${#APPLICATIONS[@]} -eq 0 ]; then 505 | for F in $(ls "${INSTALL_FOLDER}/"*"/"*"/DESCRIPTION" 2>/dev/null); do 506 | NAME=${F#${INSTALL_FOLDER}/} 507 | NAME=${NAME%%/DESCRIPTION} 508 | APPLICATIONS=("${NAME}") 509 | INCLUDE_LIST=${F%/*} 510 | INCLUDE_LIST=$(cat "${INCLUDE_LIST}/INCLUDES") 511 | INCLUDES=() 512 | for INCLUDE in $INCLUDE_LIST; do 513 | INCLUDES+=("${INCLUDE}") 514 | done 515 | EXCLUDE_LIST=${F%/*} 516 | EXCLUDE_LIST=$(cat "${EXCLUDE_LIST}/EXCLUDES") 517 | EXCLUDES=() 518 | for EXCLUDE in $EXCLUDE_LIST; do 519 | EXCLUDES+=("${EXCLUDE}") 520 | done 521 | gamInstall 522 | done 523 | else 524 | ORIG_APPLICATIONS=("${APPLICATIONS[@]}") 525 | for NAME in ${APPLICATIONS[@]}; do 526 | if [ -d "${INSTALL_FOLDER}/${NAME}" ]; then 527 | APPLICATIONS=("${NAME}") 528 | INCLUDE_LIST=$(cat "${INSTALL_FOLDER}/${NAME}/INCLUDES") 529 | INCLUDES=() 530 | for INCLUDE in $INCLUDE_LIST; do 531 | INCLUDES+=("${INCLUDE}") 532 | done 533 | EXCLUDE_LIST=$(cat "${INSTALL_FOLDER}/${NAME}/EXCLUDES") 534 | EXCLUDES=() 535 | for EXCLUDE in $EXCLUDE_LIST; do 536 | EXCLUDES+=("${EXCLUDE}") 537 | done 538 | gamInstall 539 | else 540 | printf "${RED}[!]${NORMAL} Application ${BOLD}%s${NORMAL} not installed.\n" "${NAME}" 541 | fi 542 | done 543 | fi 544 | } 545 | 546 | function gamRemove() { 547 | for APPLICATION in ${APPLICATIONS[@]}; do 548 | FOUND=false 549 | SHORTCUT=$(echo "${APPLICATION}" | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]') 550 | SHORTCUT="${SHORTCUT_FOLDER}/${SHORTCUT}.desktop" 551 | AUTHOR=${APPLICATION%%/*} 552 | APP=${APPLICATION##*/} 553 | if [ -f "${SHORTCUT}" ]; then 554 | EXE=$(grep ^Exec= "${SHORTCUT}" |head -n1) 555 | EXE="${EXE##Exec=}" 556 | if [ -L "${BIN_FOLDER}/${APP}" ]; then 557 | LINK=$(readlink -f "${BIN_FOLDER}/${APP}") 558 | if [ "${LINK}" = "${EXE}" ]; then 559 | rm -f "${BIN_FOLDER}/${APP}" 560 | fi 561 | fi 562 | if [ -L "${BIN_FOLDER}/${APP}-${AUTHOR}" ]; then 563 | LINK=$(readlink -f "${BIN_FOLDER}/${APP}-${AUTHOR}") 564 | if [ "${LINK}" = "${EXE}" ]; then 565 | rm -f "${BIN_FOLDER}/${APP}-${AUTHOR}" 566 | fi 567 | fi 568 | rm -f "${SHORTCUT}" 569 | FOUND=true 570 | fi 571 | if [ -f "${INSTALL_FOLDER}/${APPLICATION}/app/DEB" ]; then 572 | DEB=$(cat "${INSTALL_FOLDER}/${APPLICATION}/app/DEB") 573 | dpkg -r ${DEB} 574 | FOUND=true 575 | fi 576 | if [ -f "${INSTALL_FOLDER}/${APPLICATION}/app/RPM" ]; then 577 | RPM=$(cat "${INSTALL_FOLDER}/${APPLICATION}/app/RPM") 578 | rpm -e ${RPM} 579 | FOUND=true 580 | fi 581 | if [ -d "${INSTALL_FOLDER}/${APPLICATION}" ]; then 582 | rm -rf "${INSTALL_FOLDER}/${APPLICATION}" 583 | FOUND=true 584 | fi 585 | if [ -d "${INSTALL_FOLDER}/${AUTHOR}" ] && [ -z "$(ls -A "${INSTALL_FOLDER}/${AUTHOR}")" ]; then 586 | rmdir "${INSTALL_FOLDER}/${AUTHOR}" 587 | fi 588 | if [ ${FOUND} = true ]; then 589 | printf "${GREEN}[:]${NORMAL} Uninstalled ${BOLD}%s${NORMAL}.\n" "${APPLICATION}" 590 | else 591 | printf "${RED}[!]${NORMAL} Application ${BOLD}%s${NORMAL} not installed.\n" "${APPLICATION}" 592 | fi 593 | done 594 | } 595 | 596 | function gamList() { 597 | NAMES=() 598 | DESCRIPTIONS=() 599 | MAXLENGTH=0 600 | for F in $(ls "${INSTALL_FOLDER}/"*"/"*"/DESCRIPTION" 2>/dev/null); do 601 | DESCRIPTION=$(cat "${F}") 602 | NAME=${F#${INSTALL_FOLDER}/} 603 | NAME=${NAME%%/DESCRIPTION} 604 | NAMES+=("${NAME}") 605 | DESCRIPTIONS+=("${DESCRIPTION}") 606 | if [ ${#NAME} -gt ${MAXLENGTH} ]; then 607 | MAXLENGTH=${#NAME} 608 | fi 609 | done 610 | DESCLENGTH=$(( COLS - MAXLENGTH - 6 )) 611 | DESCTRUNC=$(( DESCLENGTH - 3 )) 612 | for I in ${!NAMES[@]}; do 613 | DESCRIPTION="${DESCRIPTIONS[$I]}" 614 | if [ ${#DESCRIPTION} -gt ${DESCLENGTH} ]; then 615 | DESCRIPTION="${DESCRIPTION:0:${DESCTRUNC}}..." 616 | fi 617 | printf "${GREEN}%-${MAXLENGTH}s ${NORMAL}${DIM}| ${NORMAL}%s\n" "${NAMES[$I]}" "${DESCRIPTION}" 618 | done 619 | } 620 | 621 | function createConfig() { 622 | if [ -z "${USER_MODE}" ] && [ ! -f ${CONFIG} ]; then 623 | echo '# The folder to install applications into 624 | INSTALL_FOLDER=/opt/github 625 | 626 | # Where to place temporary cache files 627 | TMP_FOLDER=/tmp/gam 628 | 629 | # Where to symlink executables for the path 630 | BIN_FOLDER=/bin 631 | 632 | # If you hit GitHub API limits, you can use a Personal Access Token 633 | # Create one here: https://github.com/settings/tokens/new 634 | #GITHUB_CREDS=username:token 635 | ' | tee -a ${CONFIG} >/dev/null 636 | printf "${GREEN}[:]${NORMAL} Configuration created in ${BOLD}${CONFIG}${NORMAL}.\n" 637 | elif [ -n "${USER_MODE}" ] && [ ! -f ${CONFIG} ]; then 638 | echo '# The folder to install applications into 639 | INSTALL_FOLDER=~/.local/share/gam/github 640 | 641 | # Where to place temporary cache files 642 | TMP_FOLDER=/tmp/gam-user 643 | 644 | # Where to symlink executables for the path 645 | BIN_FOLDER=~/bin 646 | 647 | # If you hit GitHub API limits, you can use a Personal Access Token 648 | # Create one here: https://github.com/settings/tokens/new 649 | #GITHUB_CREDS=username:token 650 | ' | tee -a ${CONFIG} >/dev/null 651 | printf "${GREEN}[:]${NORMAL} Configuration created in ${BOLD}${CONFIG}${NORMAL}.\n" 652 | else 653 | printf "${YELLOW}[:]${NORMAL} Configuration already exists in ${BOLD}${CONFIG}${NORMAL}.\n" 654 | fi 655 | } 656 | 657 | function checkApplications() { 658 | if [ ${#APPLICATIONS[@]} -eq 0 ]; then 659 | usage 660 | fi 661 | } 662 | 663 | function gamUpdate() { 664 | SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 665 | SCRIPTBIN="${0##*/}" 666 | if [ -L "${SCRIPTDIR}/${SCRIPTBIN}" ]; then 667 | SCRIPT=$(readlink -f "${SCRIPTDIR}/${SCRIPTBIN}") 668 | SCRIPTDIR=${SCRIPT%/*} 669 | SCRIPTBIN=${SCRIPT##*/} 670 | fi 671 | if [ ! -w "${SCRIPTDIR}/${SCRIPTBIN}" ]; then 672 | printf "${RED}[!]${NORMAL} ${BOLD}${SCRIPTBIN}${NORMAL} is not writable by this user. Do you need ${BOLD}sudo ${SCRIPTBIN} update${NORMAL}?\n" 673 | exit 674 | fi 675 | if [ ! -f "${TMP_FOLDER}/cache/version" ] || [ $(find "${TMP_FOLDER}/cache/version" -mmin +1440 | egrep '.*') ]; then 676 | ${CURL} -s "https://api.github.com/repos/fmstrat/gam/releases/latest" -o "${TMP_FOLDER}/cache/version" 677 | checkAPILimit "${TMP_FOLDER}/cache/version" 678 | fi 679 | JSON=$(cat "${TMP_FOLDER}/cache/version") 680 | VERSION=$(echo ${JSON} | jq -r '.tag_name') 681 | if [ "${VERSION}" == "${RELEASE}" ]; then 682 | printf "${YELLOW}[:]${NORMAL} ${BOLD}gam${NORMAL} is already the latest version.\n" 683 | return 684 | else 685 | URL=$(echo ${JSON} | jq -r '.tarball_url') 686 | ${CURL} -L "${URL}" -o "${TMP_FOLDER}/assets/gam.tgz" 687 | TMPFOLDER="${TMP_FOLDER}/assets/extract/gam" 688 | rm -rf ${TMP_FOLDER}/assets/extract/* 689 | mkdir -p "${TMPFOLDER}" 690 | tar xfz "${TMP_FOLDER}/assets/gam.tgz" -C "${TMPFOLDER}" --strip-components 1 691 | chmod --reference="${SCRIPTDIR}/${SCRIPTBIN}" "${TMP_FOLDER}/assets/extract/gam/gam" 692 | chown --reference="${SCRIPTDIR}/${SCRIPTBIN}" "${TMP_FOLDER}/assets/extract/gam/gam" 693 | cp "${TMP_FOLDER}/assets/extract/gam/gam" "${TMP_FOLDER}/gam.exec" 694 | rm -f "${TMP_FOLDER}/assets/gam.tgz" 695 | rm -rf "${TMP_FOLDER}/assets/extract/*" 696 | mv "${TMP_FOLDER}/gam.exec" "${SCRIPTDIR}/${SCRIPTBIN}" 697 | printf "${GREEN}[:]${NORMAL} Upgraded ${BOLD}gam${NORMAL} to version ${BOLD}${VERSION}${NORMAL}.\n" 698 | exit 699 | fi 700 | } 701 | 702 | function gamMain() { 703 | case "${COMMAND}" in 704 | search|find) 705 | gamVersionCheck 706 | checkApplications 707 | gamSearch 708 | ;; 709 | install|add) 710 | gamVersionCheck 711 | checkRoot 712 | checkApplications 713 | gamInstall 714 | ;; 715 | check) 716 | gamVersionCheck 717 | CHECK_ONLY=true 718 | gamUpgrade 719 | if (( RETURN == 1 )); then 720 | exit 1 721 | fi 722 | ;; 723 | upgrade) 724 | gamVersionCheck 725 | checkRoot 726 | gamUpgrade 727 | ;; 728 | update) 729 | gamUpdate 730 | ;; 731 | remove|uninstall) 732 | gamVersionCheck 733 | checkRoot 734 | checkApplications 735 | gamRemove 736 | ;; 737 | create-config) 738 | checkRoot 739 | createConfig 740 | ;; 741 | list) 742 | gamVersionCheck 743 | gamList 744 | ;; 745 | *) 746 | gamVersionCheck 747 | usage 748 | ;; 749 | esac 750 | } 751 | 752 | function notifyPrereqs() { 753 | yum >/dev/null 2>&1 754 | YUM=$? 755 | apt-get >/dev/null 2>&1 756 | APT=$? 757 | if (( YUM != 127 )); then 758 | printf "${RED}[!]${NORMAL} Missing prerequisites. Install with:\n" 759 | printf " ${BOLD}yum install -y ncurses which jq curl tar${NORMAL}\n" 760 | elif (( APT != 127 )); then 761 | printf "${RED}[!]${NORMAL} Missing prerequisites. Install with:\n" 762 | printf " ${BOLD}apt install -y ncurses-bin debianutils jq curl tar xz-utils${NORMAL}\n" 763 | fi 764 | exit 765 | } 766 | 767 | function checkPrereqs() { 768 | MISSING=false 769 | which >/dev/null 2>&1 770 | WHICH=$? 771 | if (( WHICH == 127 )); then 772 | MISSING=true 773 | else 774 | if [ -z "$(which tput)" ]; then MISSING=true; fi 775 | if [ -z "$(which jq)" ]; then MISSING=true; fi 776 | if [ -z "$(which curl)" ]; then MISSING=true; fi 777 | if [ -z "$(which tar)" ]; then MISSING=true; fi 778 | fi 779 | if [ ${MISSING} = true ]; then 780 | notifyPrereqs 781 | fi 782 | } 783 | 784 | tput >/dev/null 2>&1 785 | TPUT=$? 786 | if (( TPUT != 127 )); then 787 | BLACK="$(tput setaf 0)" 788 | RED="$(tput setaf 1)" 789 | GREEN="$(tput setaf 2)" 790 | YELLOW="$(tput setaf 3)" 791 | BLUE="$(tput setaf 4)" 792 | MAGENTA="$(tput setaf 5)" 793 | CYAN="$(tput setaf 6)" 794 | WHITE="$(tput setaf 7)" 795 | BOLD="$(tput bold)" 796 | NORMAL="$(tput sgr0)" 797 | DIM=$'\e[2m' 798 | fi 799 | 800 | checkPrereqs 801 | 802 | if [ -n "${BLACK}" ]; then 803 | BLACK="$(tput setaf 0)" 804 | RED="$(tput setaf 1)" 805 | GREEN="$(tput setaf 2)" 806 | YELLOW="$(tput setaf 3)" 807 | BLUE="$(tput setaf 4)" 808 | MAGENTA="$(tput setaf 5)" 809 | CYAN="$(tput setaf 6)" 810 | WHITE="$(tput setaf 7)" 811 | BOLD="$(tput bold)" 812 | NORMAL="$(tput sgr0)" 813 | DIM=$'\e[2m' 814 | fi 815 | 816 | 817 | COLS=$(tput cols) 818 | ROWS=$(tput lines) 819 | 820 | set -e 821 | 822 | CONFIG=/etc/gam.conf 823 | if [ -n "${USER_MODE}" ]; then 824 | mkdir -p ~/.config/gam 825 | CONFIG=~/.config/gam/gam.conf 826 | fi 827 | if [ ! -f ${CONFIG} ]; then 828 | if [ "${COMMAND}" != "create-config" ]; then 829 | C="gam create-config" 830 | if [ -n "${USER_MODE}" ]; then 831 | C="gam create-config --user" 832 | fi 833 | printf "${RED}[!]${NORMAL} Configuration does not exist, run ${BOLD}${C}${NORMAL}.\n" 834 | exit 835 | fi 836 | else 837 | . ${CONFIG} 838 | mkdir -p ${TMP_FOLDER}/cache/releases 839 | mkdir -p ${TMP_FOLDER}/cache/search 840 | mkdir -p ${TMP_FOLDER}/assets/extract 841 | if [ -z "${USER_MODE}" ]; then 842 | chmod a+rw ${TMP_FOLDER}/assets/extract 843 | fi 844 | if [ ! -d "${INSTALL_FOLDER}" ]; then 845 | mkdir -p "${INSTALL_FOLDER}" 846 | fi 847 | if [ -z "${BIN_FOLDER}" ]; then 848 | # Handle old config files 849 | BIN_FOLDER=/bin 850 | fi 851 | if [ ! -d "${BIN_FOLDER}" ]; then 852 | mkdir -p "${BIN_FOLDER}" 853 | fi 854 | fi 855 | 856 | SHORTCUT_FOLDER=/usr/share/applications 857 | if [ -n "${USER_MODE}" ]; then 858 | SHORTCUT_FOLDER=~/.local/share/applications 859 | fi 860 | 861 | CURL=curl 862 | if [ -n "${GITHUB_CREDS}" ]; then 863 | CURL="${CURL} -u ${GITHUB_CREDS}" 864 | fi 865 | 866 | if [ -n "$(which dpkg 2>/dev/null)" ]; then 867 | PACKAGE_MANAGER=deb 868 | elif [ -n "$(which rpm 2>/dev/null)" ]; then 869 | PACKAGE_MANAGER=rpm 870 | fi 871 | 872 | gamMain 873 | 874 | } 875 | 876 | exit ${RETURN} -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) 5 | 6 | Everyone is permitted to copy and distribute verbatim copies of this license 7 | document, but changing it is not allowed. 8 | 9 | ## Preamble 10 | 11 | The GNU General Public License is a free, copyleft license for software and 12 | other kinds of works. 13 | 14 | The licenses for most software and other practical works are designed to take 15 | away your freedom to share and change the works. By contrast, the GNU General 16 | Public License is intended to guarantee your freedom to share and change all 17 | versions of a program--to make sure it remains free software for all its users. 18 | We, the Free Software Foundation, use the GNU General Public License for most 19 | of our software; it applies also to any other work released this way by its 20 | authors. You can apply it to your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not price. Our 23 | General Public Licenses are designed to make sure that you have the freedom to 24 | distribute copies of free software (and charge for them if you wish), that you 25 | receive source code or can get it if you want it, that you can change the 26 | software or use pieces of it in new free programs, and that you know you can do 27 | these things. 28 | 29 | To protect your rights, we need to prevent others from denying you these rights 30 | or asking you to surrender the rights. Therefore, you have certain 31 | responsibilities if you distribute copies of the software, or if you modify it: 32 | responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether gratis or for 35 | a fee, you must pass on to the recipients the same freedoms that you received. 36 | You must make sure that they, too, receive or can get the source code. And you 37 | must show them these terms so they know their rights. 38 | 39 | Developers that use the GNU GPL protect your rights with two steps: 40 | 41 | 1. assert copyright on the software, and 42 | 2. offer you this License giving you legal permission to copy, distribute 43 | and/or modify it. 44 | 45 | For the developers' and authors' protection, the GPL clearly explains that 46 | there is no warranty for this free software. For both users' and authors' sake, 47 | the GPL requires that modified versions be marked as changed, so that their 48 | problems will not be attributed erroneously to authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run modified 51 | versions of the software inside them, although the manufacturer can do so. This 52 | is fundamentally incompatible with the aim of protecting users' freedom to 53 | change the software. The systematic pattern of such abuse occurs in the area of 54 | products for individuals to use, which is precisely where it is most 55 | unacceptable. Therefore, we have designed this version of the GPL to prohibit 56 | the practice for those products. If such problems arise substantially in other 57 | domains, we stand ready to extend this provision to those domains in future 58 | versions of the GPL, as needed to protect the freedom of users. 59 | 60 | Finally, every program is threatened constantly by software patents. States 61 | should not allow patents to restrict development and use of software on 62 | general-purpose computers, but in those that do, we wish to avoid the special 63 | danger that patents applied to a free program could make it effectively 64 | proprietary. To prevent this, the GPL assures that patents cannot be used to 65 | render the program non-free. 66 | 67 | The precise terms and conditions for copying, distribution and modification 68 | follow. 69 | 70 | ## TERMS AND CONDITIONS 71 | 72 | ### 0. Definitions. 73 | 74 | *This License* refers to version 3 of the GNU General Public License. 75 | 76 | *Copyright* also means copyright-like laws that apply to other kinds of works, 77 | such as semiconductor masks. 78 | 79 | *The Program* refers to any copyrightable work licensed under this License. 80 | Each licensee is addressed as *you*. *Licensees* and *recipients* may be 81 | individuals or organizations. 82 | 83 | To *modify* a work means to copy from or adapt all or part of the work in a 84 | fashion requiring copyright permission, other than the making of an exact copy. 85 | The resulting work is called a *modified version* of the earlier work or a work 86 | *based on* the earlier work. 87 | 88 | A *covered work* means either the unmodified Program or a work based on the 89 | Program. 90 | 91 | To *propagate* a work means to do anything with it that, without permission, 92 | would make you directly or secondarily liable for infringement under applicable 93 | copyright law, except executing it on a computer or modifying a private copy. 94 | Propagation includes copying, distribution (with or without modification), 95 | making available to the public, and in some countries other activities as well. 96 | 97 | To *convey* a work means any kind of propagation that enables other parties to 98 | make or receive copies. Mere interaction with a user through a computer 99 | network, with no transfer of a copy, is not conveying. 100 | 101 | An interactive user interface displays *Appropriate Legal Notices* to the 102 | extent that it includes a convenient and prominently visible feature that 103 | 104 | 1. displays an appropriate copyright notice, and 105 | 2. tells the user that there is no warranty for the work (except to the 106 | extent that warranties are provided), that licensees may convey the work 107 | under this License, and how to view a copy of this License. 108 | 109 | If the interface presents a list of user commands or options, such as a menu, a 110 | prominent item in the list meets this criterion. 111 | 112 | ### 1. Source Code. 113 | 114 | The *source code* for a work means the preferred form of the work for making 115 | modifications to it. *Object code* means any non-source form of a work. 116 | 117 | A *Standard Interface* means an interface that either is an official standard 118 | defined by a recognized standards body, or, in the case of interfaces specified 119 | for a particular programming language, one that is widely used among developers 120 | working in that language. 121 | 122 | The *System Libraries* of an executable work include anything, other than the 123 | work as a whole, that (a) is included in the normal form of packaging a Major 124 | Component, but which is not part of that Major Component, and (b) serves only 125 | to enable use of the work with that Major Component, or to implement a Standard 126 | Interface for which an implementation is available to the public in source code 127 | form. A *Major Component*, in this context, means a major essential component 128 | (kernel, window system, and so on) of the specific operating system (if any) on 129 | which the executable work runs, or a compiler used to produce the work, or an 130 | object code interpreter used to run it. 131 | 132 | The *Corresponding Source* for a work in object code form means all the source 133 | code needed to generate, install, and (for an executable work) run the object 134 | code and to modify the work, including scripts to control those activities. 135 | However, it does not include the work's System Libraries, or general-purpose 136 | tools or generally available free programs which are used unmodified in 137 | performing those activities but which are not part of the work. For example, 138 | Corresponding Source includes interface definition files associated with source 139 | files for the work, and the source code for shared libraries and dynamically 140 | linked subprograms that the work is specifically designed to require, such as 141 | by intimate data communication or control flow between those subprograms and 142 | other parts of the work. 143 | 144 | The Corresponding Source need not include anything that users can regenerate 145 | automatically from other parts of the Corresponding Source. 146 | 147 | The Corresponding Source for a work in source code form is that same work. 148 | 149 | ### 2. Basic Permissions. 150 | 151 | All rights granted under this License are granted for the term of copyright on 152 | the Program, and are irrevocable provided the stated conditions are met. This 153 | License explicitly affirms your unlimited permission to run the unmodified 154 | Program. The output from running a covered work is covered by this License only 155 | if the output, given its content, constitutes a covered work. This License 156 | acknowledges your rights of fair use or other equivalent, as provided by 157 | copyright law. 158 | 159 | You may make, run and propagate covered works that you do not convey, without 160 | conditions so long as your license otherwise remains in force. You may convey 161 | covered works to others for the sole purpose of having them make modifications 162 | exclusively for you, or provide you with facilities for running those works, 163 | provided that you comply with the terms of this License in conveying all 164 | material for which you do not control copyright. Those thus making or running 165 | the covered works for you must do so exclusively on your behalf, under your 166 | direction and control, on terms that prohibit them from making any copies of 167 | your copyrighted material outside their relationship with you. 168 | 169 | Conveying under any other circumstances is permitted solely under the 170 | conditions stated below. Sublicensing is not allowed; section 10 makes it 171 | unnecessary. 172 | 173 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 174 | 175 | No covered work shall be deemed part of an effective technological measure 176 | under any applicable law fulfilling obligations under article 11 of the WIPO 177 | copyright treaty adopted on 20 December 1996, or similar laws prohibiting or 178 | restricting circumvention of such measures. 179 | 180 | When you convey a covered work, you waive any legal power to forbid 181 | circumvention of technological measures to the extent such circumvention is 182 | effected by exercising rights under this License with respect to the covered 183 | work, and you disclaim any intention to limit operation or modification of the 184 | work as a means of enforcing, against the work's users, your or third parties' 185 | legal rights to forbid circumvention of technological measures. 186 | 187 | ### 4. Conveying Verbatim Copies. 188 | 189 | You may convey verbatim copies of the Program's source code as you receive it, 190 | in any medium, provided that you conspicuously and appropriately publish on 191 | each copy an appropriate copyright notice; keep intact all notices stating that 192 | this License and any non-permissive terms added in accord with section 7 apply 193 | to the code; keep intact all notices of the absence of any warranty; and give 194 | all recipients a copy of this License along with the Program. 195 | 196 | You may charge any price or no price for each copy that you convey, and you may 197 | offer support or warranty protection for a fee. 198 | 199 | ### 5. Conveying Modified Source Versions. 200 | 201 | You may convey a work based on the Program, or the modifications to produce it 202 | from the Program, in the form of source code under the terms of section 4, 203 | provided that you also meet all of these conditions: 204 | 205 | - a) The work must carry prominent notices stating that you modified it, and 206 | giving a relevant date. 207 | - b) The work must carry prominent notices stating that it is released under 208 | this License and any conditions added under section 7. This requirement 209 | modifies the requirement in section 4 to *keep intact all notices*. 210 | - c) You must license the entire work, as a whole, under this License to 211 | anyone who comes into possession of a copy. This License will therefore 212 | apply, along with any applicable section 7 additional terms, to the whole 213 | of the work, and all its parts, regardless of how they are packaged. This 214 | License gives no permission to license the work in any other way, but it 215 | does not invalidate such permission if you have separately received it. 216 | - d) If the work has interactive user interfaces, each must display 217 | Appropriate Legal Notices; however, if the Program has interactive 218 | interfaces that do not display Appropriate Legal Notices, your work need 219 | not make them do so. 220 | 221 | A compilation of a covered work with other separate and independent works, 222 | which are not by their nature extensions of the covered work, and which are not 223 | combined with it such as to form a larger program, in or on a volume of a 224 | storage or distribution medium, is called an *aggregate* if the compilation and 225 | its resulting copyright are not used to limit the access or legal rights of the 226 | compilation's users beyond what the individual works permit. Inclusion of a 227 | covered work in an aggregate does not cause this License to apply to the other 228 | parts of the aggregate. 229 | 230 | ### 6. Conveying Non-Source Forms. 231 | 232 | You may convey a covered work in object code form under the terms of sections 4 233 | and 5, provided that you also convey the machine-readable Corresponding Source 234 | under the terms of this License, in one of these ways: 235 | 236 | - a) Convey the object code in, or embodied in, a physical product (including 237 | a physical distribution medium), accompanied by the Corresponding Source 238 | fixed on a durable physical medium customarily used for software 239 | interchange. 240 | - b) Convey the object code in, or embodied in, a physical product (including 241 | a physical distribution medium), accompanied by a written offer, valid for 242 | at least three years and valid for as long as you offer spare parts or 243 | customer support for that product model, to give anyone who possesses the 244 | object code either 245 | 1. a copy of the Corresponding Source for all the software in the product 246 | that is covered by this License, on a durable physical medium 247 | customarily used for software interchange, for a price no more than your 248 | reasonable cost of physically performing this conveying of source, or 249 | 2. access to copy the Corresponding Source from a network server at no 250 | charge. 251 | - c) Convey individual copies of the object code with a copy of the written 252 | offer to provide the Corresponding Source. This alternative is allowed only 253 | occasionally and noncommercially, and only if you received the object code 254 | with such an offer, in accord with subsection 6b. 255 | - d) Convey the object code by offering access from a designated place 256 | (gratis or for a charge), and offer equivalent access to the Corresponding 257 | Source in the same way through the same place at no further charge. You 258 | need not require recipients to copy the Corresponding Source along with the 259 | object code. If the place to copy the object code is a network server, the 260 | Corresponding Source may be on a different server operated by you or a 261 | third party) that supports equivalent copying facilities, provided you 262 | maintain clear directions next to the object code saying where to find the 263 | Corresponding Source. Regardless of what server hosts the Corresponding 264 | Source, you remain obligated to ensure that it is available for as long as 265 | needed to satisfy these requirements. 266 | - e) Convey the object code using peer-to-peer transmission, provided you 267 | inform other peers where the object code and Corresponding Source of the 268 | work are being offered to the general public at no charge under subsection 269 | 6d. 270 | 271 | A separable portion of the object code, whose source code is excluded from the 272 | Corresponding Source as a System Library, need not be included in conveying the 273 | object code work. 274 | 275 | A *User Product* is either 276 | 277 | 1. a *consumer product*, which means any tangible personal property which is 278 | normally used for personal, family, or household purposes, or 279 | 2. anything designed or sold for incorporation into a dwelling. 280 | 281 | In determining whether a product is a consumer product, doubtful cases shall be 282 | resolved in favor of coverage. For a particular product received by a 283 | particular user, *normally used* refers to a typical or common use of that 284 | class of product, regardless of the status of the particular user or of the way 285 | in which the particular user actually uses, or expects or is expected to use, 286 | the product. A product is a consumer product regardless of whether the product 287 | has substantial commercial, industrial or non-consumer uses, unless such uses 288 | represent the only significant mode of use of the product. 289 | 290 | *Installation Information* for a User Product means any methods, procedures, 291 | authorization keys, or other information required to install and execute 292 | modified versions of a covered work in that User Product from a modified 293 | version of its Corresponding Source. The information must suffice to ensure 294 | that the continued functioning of the modified object code is in no case 295 | prevented or interfered with solely because modification has been made. 296 | 297 | If you convey an object code work under this section in, or with, or 298 | specifically for use in, a User Product, and the conveying occurs as part of a 299 | transaction in which the right of possession and use of the User Product is 300 | transferred to the recipient in perpetuity or for a fixed term (regardless of 301 | how the transaction is characterized), the Corresponding Source conveyed under 302 | this section must be accompanied by the Installation Information. But this 303 | requirement does not apply if neither you nor any third party retains the 304 | ability to install modified object code on the User Product (for example, the 305 | work has been installed in ROM). 306 | 307 | The requirement to provide Installation Information does not include a 308 | requirement to continue to provide support service, warranty, or updates for a 309 | work that has been modified or installed by the recipient, or for the User 310 | Product in which it has been modified or installed. Access to a network may be 311 | denied when the modification itself materially and adversely affects the 312 | operation of the network or violates the rules and protocols for communication 313 | across the network. 314 | 315 | Corresponding Source conveyed, and Installation Information provided, in accord 316 | with this section must be in a format that is publicly documented (and with an 317 | implementation available to the public in source code form), and must require 318 | no special password or key for unpacking, reading or copying. 319 | 320 | ### 7. Additional Terms. 321 | 322 | *Additional permissions* are terms that supplement the terms of this License by 323 | making exceptions from one or more of its conditions. Additional permissions 324 | that are applicable to the entire Program shall be treated as though they were 325 | included in this License, to the extent that they are valid under applicable 326 | law. If additional permissions apply only to part of the Program, that part may 327 | be used separately under those permissions, but the entire Program remains 328 | governed by this License without regard to the additional permissions. 329 | 330 | When you convey a copy of a covered work, you may at your option remove any 331 | additional permissions from that copy, or from any part of it. (Additional 332 | permissions may be written to require their own removal in certain cases when 333 | you modify the work.) You may place additional permissions on material, added 334 | by you to a covered work, for which you have or can give appropriate copyright 335 | permission. 336 | 337 | Notwithstanding any other provision of this License, for material you add to a 338 | covered work, you may (if authorized by the copyright holders of that material) 339 | supplement the terms of this License with terms: 340 | 341 | - a) Disclaiming warranty or limiting liability differently from the terms of 342 | sections 15 and 16 of this License; or 343 | - b) Requiring preservation of specified reasonable legal notices or author 344 | attributions in that material or in the Appropriate Legal Notices displayed 345 | by works containing it; or 346 | - c) Prohibiting misrepresentation of the origin of that material, or 347 | requiring that modified versions of such material be marked in reasonable 348 | ways as different from the original version; or 349 | - d) Limiting the use for publicity purposes of names of licensors or authors 350 | of the material; or 351 | - e) Declining to grant rights under trademark law for use of some trade 352 | names, trademarks, or service marks; or 353 | - f) Requiring indemnification of licensors and authors of that material by 354 | anyone who conveys the material (or modified versions of it) with 355 | contractual assumptions of liability to the recipient, for any liability 356 | that these contractual assumptions directly impose on those licensors and 357 | authors. 358 | 359 | All other non-permissive additional terms are considered *further restrictions* 360 | within the meaning of section 10. If the Program as you received it, or any 361 | part of it, contains a notice stating that it is governed by this License along 362 | with a term that is a further restriction, you may remove that term. If a 363 | license document contains a further restriction but permits relicensing or 364 | conveying under this License, you may add to a covered work material governed 365 | by the terms of that license document, provided that the further restriction 366 | does not survive such relicensing or conveying. 367 | 368 | If you add terms to a covered work in accord with this section, you must place, 369 | in the relevant source files, a statement of the additional terms that apply to 370 | those files, or a notice indicating where to find the applicable terms. 371 | 372 | Additional terms, permissive or non-permissive, may be stated in the form of a 373 | separately written license, or stated as exceptions; the above requirements 374 | apply either way. 375 | 376 | ### 8. Termination. 377 | 378 | You may not propagate or modify a covered work except as expressly provided 379 | under this License. Any attempt otherwise to propagate or modify it is void, 380 | and will automatically terminate your rights under this License (including any 381 | patent licenses granted under the third paragraph of section 11). 382 | 383 | However, if you cease all violation of this License, then your license from a 384 | particular copyright holder is reinstated 385 | 386 | - a) provisionally, unless and until the copyright holder explicitly and 387 | finally terminates your license, and 388 | - b) permanently, if the copyright holder fails to notify you of the 389 | violation by some reasonable means prior to 60 days after the cessation. 390 | 391 | Moreover, your license from a particular copyright holder is reinstated 392 | permanently if the copyright holder notifies you of the violation by some 393 | reasonable means, this is the first time you have received notice of violation 394 | of this License (for any work) from that copyright holder, and you cure the 395 | violation prior to 30 days after your receipt of the notice. 396 | 397 | Termination of your rights under this section does not terminate the licenses 398 | of parties who have received copies or rights from you under this License. If 399 | your rights have been terminated and not permanently reinstated, you do not 400 | qualify to receive new licenses for the same material under section 10. 401 | 402 | ### 9. Acceptance Not Required for Having Copies. 403 | 404 | You are not required to accept this License in order to receive or run a copy 405 | of the Program. Ancillary propagation of a covered work occurring solely as a 406 | consequence of using peer-to-peer transmission to receive a copy likewise does 407 | not require acceptance. However, nothing other than this License grants you 408 | permission to propagate or modify any covered work. These actions infringe 409 | copyright if you do not accept this License. Therefore, by modifying or 410 | propagating a covered work, you indicate your acceptance of this License to do 411 | so. 412 | 413 | ### 10. Automatic Licensing of Downstream Recipients. 414 | 415 | Each time you convey a covered work, the recipient automatically receives a 416 | license from the original licensors, to run, modify and propagate that work, 417 | subject to this License. You are not responsible for enforcing compliance by 418 | third parties with this License. 419 | 420 | An *entity transaction* is a transaction transferring control of an 421 | organization, or substantially all assets of one, or subdividing an 422 | organization, or merging organizations. If propagation of a covered work 423 | results from an entity transaction, each party to that transaction who receives 424 | a copy of the work also receives whatever licenses to the work the party's 425 | predecessor in interest had or could give under the previous paragraph, plus a 426 | right to possession of the Corresponding Source of the work from the 427 | predecessor in interest, if the predecessor has it or can get it with 428 | reasonable efforts. 429 | 430 | You may not impose any further restrictions on the exercise of the rights 431 | granted or affirmed under this License. For example, you may not impose a 432 | license fee, royalty, or other charge for exercise of rights granted under this 433 | License, and you may not initiate litigation (including a cross-claim or 434 | counterclaim in a lawsuit) alleging that any patent claim is infringed by 435 | making, using, selling, offering for sale, or importing the Program or any 436 | portion of it. 437 | 438 | ### 11. Patents. 439 | 440 | A *contributor* is a copyright holder who authorizes use under this License of 441 | the Program or a work on which the Program is based. The work thus licensed is 442 | called the contributor's *contributor version*. 443 | 444 | A contributor's *essential patent claims* are all patent claims owned or 445 | controlled by the contributor, whether already acquired or hereafter acquired, 446 | that would be infringed by some manner, permitted by this License, of making, 447 | using, or selling its contributor version, but do not include claims that would 448 | be infringed only as a consequence of further modification of the contributor 449 | version. For purposes of this definition, *control* includes the right to grant 450 | patent sublicenses in a manner consistent with the requirements of this 451 | License. 452 | 453 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent 454 | license under the contributor's essential patent claims, to make, use, sell, 455 | offer for sale, import and otherwise run, modify and propagate the contents of 456 | its contributor version. 457 | 458 | In the following three paragraphs, a *patent license* is any express agreement 459 | or commitment, however denominated, not to enforce a patent (such as an express 460 | permission to practice a patent or covenant not to sue for patent 461 | infringement). To *grant* such a patent license to a party means to make such 462 | an agreement or commitment not to enforce a patent against the party. 463 | 464 | If you convey a covered work, knowingly relying on a patent license, and the 465 | Corresponding Source of the work is not available for anyone to copy, free of 466 | charge and under the terms of this License, through a publicly available 467 | network server or other readily accessible means, then you must either 468 | 469 | 1. cause the Corresponding Source to be so available, or 470 | 2. arrange to deprive yourself of the benefit of the patent license for this 471 | particular work, or 472 | 3. arrange, in a manner consistent with the requirements of this License, to 473 | extend the patent license to downstream recipients. 474 | 475 | *Knowingly relying* means you have actual knowledge that, but for the patent 476 | license, your conveying the covered work in a country, or your recipient's use 477 | of the covered work in a country, would infringe one or more identifiable 478 | patents in that country that you have reason to believe are valid. 479 | 480 | If, pursuant to or in connection with a single transaction or arrangement, you 481 | convey, or propagate by procuring conveyance of, a covered work, and grant a 482 | patent license to some of the parties receiving the covered work authorizing 483 | them to use, propagate, modify or convey a specific copy of the covered work, 484 | then the patent license you grant is automatically extended to all recipients 485 | of the covered work and works based on it. 486 | 487 | A patent license is *discriminatory* if it does not include within the scope of 488 | its coverage, prohibits the exercise of, or is conditioned on the non-exercise 489 | of one or more of the rights that are specifically granted under this License. 490 | You may not convey a covered work if you are a party to an arrangement with a 491 | third party that is in the business of distributing software, under which you 492 | make payment to the third party based on the extent of your activity of 493 | conveying the work, and under which the third party grants, to any of the 494 | parties who would receive the covered work from you, a discriminatory patent 495 | license 496 | 497 | - a) in connection with copies of the covered work conveyed by you (or copies 498 | made from those copies), or 499 | - b) primarily for and in connection with specific products or compilations 500 | that contain the covered work, unless you entered into that arrangement, or 501 | that patent license was granted, prior to 28 March 2007. 502 | 503 | Nothing in this License shall be construed as excluding or limiting any implied 504 | license or other defenses to infringement that may otherwise be available to 505 | you under applicable patent law. 506 | 507 | ### 12. No Surrender of Others' Freedom. 508 | 509 | If conditions are imposed on you (whether by court order, agreement or 510 | otherwise) that contradict the conditions of this License, they do not excuse 511 | you from the conditions of this License. If you cannot convey a covered work so 512 | as to satisfy simultaneously your obligations under this License and any other 513 | pertinent obligations, then as a consequence you may not convey it at all. For 514 | example, if you agree to terms that obligate you to collect a royalty for 515 | further conveying from those to whom you convey the Program, the only way you 516 | could satisfy both those terms and this License would be to refrain entirely 517 | from conveying the Program. 518 | 519 | ### 13. Use with the GNU Affero General Public License. 520 | 521 | Notwithstanding any other provision of this License, you have permission to 522 | link or combine any covered work with a work licensed under version 3 of the 523 | GNU Affero General Public License into a single combined work, and to convey 524 | the resulting work. The terms of this License will continue to apply to the 525 | part which is the covered work, but the special requirements of the GNU Affero 526 | General Public License, section 13, concerning interaction through a network 527 | will apply to the combination as such. 528 | 529 | ### 14. Revised Versions of this License. 530 | 531 | The Free Software Foundation may publish revised and/or new versions of the GNU 532 | General Public License from time to time. Such new versions will be similar in 533 | spirit to the present version, but may differ in detail to address new problems 534 | or concerns. 535 | 536 | Each version is given a distinguishing version number. If the Program specifies 537 | that a certain numbered version of the GNU General Public License *or any later 538 | version* applies to it, you have the option of following the terms and 539 | conditions either of that numbered version or of any later version published by 540 | the Free Software Foundation. If the Program does not specify a version number 541 | of the GNU General Public License, you may choose any version ever published by 542 | the Free Software Foundation. 543 | 544 | If the Program specifies that a proxy can decide which future versions of the 545 | GNU General Public License can be used, that proxy's public statement of 546 | acceptance of a version permanently authorizes you to choose that version for 547 | the Program. 548 | 549 | Later license versions may give you additional or different permissions. 550 | However, no additional obligations are imposed on any author or copyright 551 | holder as a result of your choosing to follow a later version. 552 | 553 | ### 15. Disclaimer of Warranty. 554 | 555 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE 556 | LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER 557 | PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER 558 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 559 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 560 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 561 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR 562 | CORRECTION. 563 | 564 | ### 16. Limitation of Liability. 565 | 566 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY 567 | COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS 568 | PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 569 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE 570 | THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED 571 | INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE 572 | PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY 573 | HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 574 | 575 | ### 17. Interpretation of Sections 15 and 16. 576 | 577 | If the disclaimer of warranty and limitation of liability provided above cannot 578 | be given local legal effect according to their terms, reviewing courts shall 579 | apply local law that most closely approximates an absolute waiver of all civil 580 | liability in connection with the Program, unless a warranty or assumption of 581 | liability accompanies a copy of the Program in return for a fee. 582 | 583 | ## END OF TERMS AND CONDITIONS ### 584 | 585 | ### How to Apply These Terms to Your New Programs 586 | 587 | If you develop a new program, and you want it to be of the greatest possible 588 | use to the public, the best way to achieve this is to make it free software 589 | which everyone can redistribute and change under these terms. 590 | 591 | To do so, attach the following notices to the program. It is safest to attach 592 | them to the start of each source file to most effectively state the exclusion 593 | of warranty; and each file should have at least the *copyright* line and a 594 | pointer to where the full notice is found. 595 | 596 | 597 | Copyright (C) 598 | 599 | This program is free software: you can redistribute it and/or modify 600 | it under the terms of the GNU General Public License as published by 601 | the Free Software Foundation, either version 3 of the License, or 602 | (at your option) any later version. 603 | 604 | This program is distributed in the hope that it will be useful, 605 | but WITHOUT ANY WARRANTY; without even the implied warranty of 606 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 607 | GNU General Public License for more details. 608 | 609 | You should have received a copy of the GNU General Public License 610 | along with this program. If not, see . 611 | 612 | Also add information on how to contact you by electronic and paper mail. 613 | 614 | If the program does terminal interaction, make it output a short notice like 615 | this when it starts in an interactive mode: 616 | 617 | Copyright (C) 618 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 619 | This is free software, and you are welcome to redistribute it 620 | under certain conditions; type `show c' for details. 621 | 622 | The hypothetical commands `show w` and `show c` should show the appropriate 623 | parts of the General Public License. Of course, your program's commands might 624 | be different; for a GUI interface, you would use an *about box*. 625 | 626 | You should also get your employer (if you work as a programmer) or school, if 627 | any, to sign a *copyright disclaimer* for the program, if necessary. For more 628 | information on this, and how to apply and follow the GNU GPL, see 629 | [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). 630 | 631 | The GNU General Public License does not permit incorporating your program into 632 | proprietary programs. If your program is a subroutine library, you may consider 633 | it more useful to permit linking proprietary applications with the library. If 634 | this is what you want to do, use the GNU Lesser General Public License instead 635 | of this License. But first, please read 636 | [http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). 637 | --------------------------------------------------------------------------------