Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 55 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #!/usr/bin/env bash
  2.  
  3. FOLDER=$1
  4. WAR_FILE=$2
  5. DIR=$(pwd)
  6. BACKUP_WAR_FILE="original_$WAR_FILE"
  7.  
  8. if [ -z "$FOLDER" ]
  9. then
  10.   echo "First attribute can't be empty"
  11.   exit 1
  12. fi
  13.  
  14. if [ -z "$WAR_FILE" ]
  15. then
  16.   echo "Second attribute can't be empty"
  17.   exit 1
  18. fi
  19.  
  20. echo "Injecting '$FOLDER' folder structure into $WAR_FILE"
  21. echo "  > Create $WAR_FILE backup: $BACKUP_WAR_FILE"
  22. cp $WAR_FILE $BACKUP_WAR_FILE
  23.  
  24. echo "  > Temporary move $WAR_FILE to $FOLDER"
  25. mv $WAR_FILE $FOLDER
  26. cd $FOLDER
  27.  
  28. echo "  > Repackaging $WAR_FILE with content of $FOLDER"
  29. zip -gr $WAR_FILE ./
  30.  
  31. echo "  > Move repackaged $WAR_FILE original destination: $DIR"
  32. mv $WAR_FILE $DIR
  33. cd $DIR
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top