summaryrefslogtreecommitdiffstats
path: root/Monitoring/MonitoringTool/PacketTracking/addLicense.sh
diff options
context:
space:
mode:
authorpikusa <pikusa@man.poznan.pl>2013-04-03 13:18:17 (GMT)
committer pikusa <pikusa@man.poznan.pl>2013-04-03 13:18:17 (GMT)
commit2f2a3a129c91de540e66c3bfbe30b0df1942cd4b (patch)
tree2d313cdf0068af368d4de6067d676be16f6a6464 /Monitoring/MonitoringTool/PacketTracking/addLicense.sh
parentff8aa232b071a9b54dff833714a870fd0aec0b30 (diff)
downloadnovi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.zip
novi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.tar.gz
novi-public-2f2a3a129c91de540e66c3bfbe30b0df1942cd4b.tar.bz2
project commit and dir tree change
Diffstat (limited to 'Monitoring/MonitoringTool/PacketTracking/addLicense.sh')
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/addLicense.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/Monitoring/MonitoringTool/PacketTracking/addLicense.sh b/Monitoring/MonitoringTool/PacketTracking/addLicense.sh
new file mode 100644
index 0000000..8174e92
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/addLicense.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+LICENSE_FILE=
+attach_license() #file list
+{
+ for file in $*; do
+ echo "attach [$LICENSE_FILE] to [$file]"
+ if [ "$file" = "$LICENSE_FILE" ]; then
+ echo "[skip] source equals target"
+ else
+ if [ ${!SIMULATE_EXECUTION[@]} ]; then
+ echo "this is a simulation"
+ else
+ cat $LICENSE_FILE $file > tmp.attach
+ mv tmp.attach $file
+ fi
+ fi
+ done
+ exit 0
+}
+
+helper()
+{
+ echo -e "usage: $0 [options] files... "
+ echo -e " Options:"
+ echo -e "\t-l <text file> file to attach to files-list"
+ echo -e "\t-s simulate execution (must be first argument)"
+ echo -e "\t-h, --help this help"
+ exit 1
+}
+
+
+if [ $# -eq 0 ]; then
+ helper
+fi
+
+# parameter parsing
+while [ $# -gt 0 ]; do
+ case $1 in
+ "-l")
+ # read configuration file
+ shift #shift parameter
+ LICENSE_FILE=$1
+ shift #file list
+ attach_license $*
+ ;;
+ "-s")
+ SIMULATE_EXECUTION=
+ ;;
+ "--help"|"-h"|*)
+ helper
+ ;;
+ esac
+ shift
+done