Advertisement
TitanFail

Invoice Ninja Update Script v3.0

May 21st, 2017
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.92 KB | None | 0 0
  1. #!/bin/bash -ue
  2. #Invoice Ninja Self-Hosted Update
  3. #USE AT YOUR OWN RISK
  4. #Replace <user> and </path/to/ninja> with your specifics, obviously.
  5.  
  6. tempdir="/home/<user>/download/InvoiceNinja"
  7. ninjahome="</path/to/ninja>"
  8. ninjatemp="$tempdir/ninja"
  9. ninjastore="$ninjahome/storage"
  10.  
  11. read -ep 'Enter Version Number (ex. "3.3.3"): ' ninjaver
  12.  
  13. ninjafile="ninja-v$ninjaver.zip"
  14. ninjaurl="https://download.invoiceninja.com/$ninjafile"
  15. ninjazip="$tempdir/$ninjafile"
  16.  
  17. wget -P "$tempdir/" "$ninjaurl"
  18.  
  19. unzip "$ninjazip" -d "$tempdir/"
  20.  
  21. sudo rsync -vtr "$ninjatemp/" "$ninjahome/"
  22.  
  23. printf '\nResetting permissions for "%s" ...\n\n' "$ninjastore"
  24. sudo chown -R www-data:www-data "$ninjastore/"
  25. sudo chmod -R 775 "$ninjastore/"
  26.  
  27. printf 'Removing downloaded ZIP file "%s" ...\n\nRemoving temporary folder "%s" ...\n\n' "$ninjazip" "$tempdir"
  28. rm -rf "$tempdir/"
  29.  
  30. printf 'Invoice Ninja successfully updated to v%s!\n\n' "$ninjaver"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement