summaryrefslogtreecommitdiffstats
path: root/templates/insert_ident_string.sh
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /templates/insert_ident_string.sh
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'templates/insert_ident_string.sh')
-rw-r--r--templates/insert_ident_string.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/templates/insert_ident_string.sh b/templates/insert_ident_string.sh
new file mode 100644
index 00000000..4b651d47
--- /dev/null
+++ b/templates/insert_ident_string.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 template mimetype"
+ exit 1
+fi
+file=$1
+mime=$2
+if [ ! -e "$file" ]; then
+ echo "$file doesn't exist"
+ exit 2
+fi
+
+# Remove documentinfo.xml
+mv $file $file.gz && gunzip $file.gz && tar --delete documentinfo.xml -f $file
+gzip -n $file && mv -f $file.gz $file || exit 1
+
+tmpfile=$file.tmp
+echo -e -n '\x01f\x8b\x8\x8\x0\x0\x0\x0\x0\x3' > $tmpfile
+echo -n "KOffice $mime" >> $tmpfile
+echo -e -n '\x04\x06\x00' >> $tmpfile
+#outsize=`stat $tmpfile | grep 'Size:' | gawk '{print $2;}'`
+#dd if=$file of=$tmpfile bs=1 skip=10 seek=$outsize
+#cut -b 11- $file --output-delimiter="" >> $tmpfile
+tail --bytes=+11 $file >> $tmpfile
+
+echo "Checking ident string:"
+file $tmpfile
+
+#length=${#mime}
+#echo "Checking size (new one should be $((2+$length)) bigger)"
+#ls -l $file $tmpfile
+
+echo "Checking contents:"
+tar tvzf $tmpfile
+
+echo "Now do this if you're ok with the result: mv $tmpfile $file"
+