summaryrefslogtreecommitdiff
path: root/convert.sh
diff options
context:
space:
mode:
authordiptighosalkar2016-03-18 11:36:10 +0530
committerdiptighosalkar2016-03-18 11:36:10 +0530
commit7031c187322191a50280259f2c4ad38b03bafb69 (patch)
tree697056452509c1eb682ce2040d4f08be9f425e88 /convert.sh
downloadEsim-Pspice-to-kicad-convertor-7031c187322191a50280259f2c4ad38b03bafb69.tar.gz
Esim-Pspice-to-kicad-convertor-7031c187322191a50280259f2c4ad38b03bafb69.tar.bz2
Esim-Pspice-to-kicad-convertor-7031c187322191a50280259f2c4ad38b03bafb69.zip
Initial commit
Diffstat (limited to 'convert.sh')
-rwxr-xr-xconvert.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/convert.sh b/convert.sh
new file mode 100755
index 0000000..30436ad
--- /dev/null
+++ b/convert.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+#Log file location
+log="/var/log/psicekicad.log"
+
+echo "###########Start Conversion from PSPICE to KICAD#################" >> $log
+echo "" >>$log
+echo "The Conversion starts at `date`" >> $log
+####Getting Parameter
+convertedSchematic=$1
+filepath=$2
+username=$3
+cwd=`pwd`
+
+echo "">>$log
+echo "The paramters to the script is : ">>$log
+echo "File : $filepath">>$log
+echo "Username : $username">>$log
+filename=`basename $filepath`
+filewithoutExt="${filename%.*}"
+
+echo "File name is : $filename">>$log
+echo "File name without extension : $filewithoutExt">>$log
+echo "">>$log
+
+#Create Directory for every User
+
+if [ -d $convertedSchematic/$username ];then
+ echo "User directory $username is already available">>$log
+else
+ mkdir -p $convertedSchematic/$username
+fi
+
+echo "The converted file will be present at $convertedSchematic/$username">>$log
+
+#Creating directory for uploaded Project
+mkdir -p $convertedSchematic/$username/$filewithoutExt
+
+#Converting PSpice to Kicad Schematic
+echo "Calling Schematic conversion script" >>$log
+/var/www/html/esim_in/sites/all/modules/pspice_to_kicad/schConverter64 $filepath $convertedSchematic/$username/$filewithoutExt/$filename 2>&1>>$log
+
+#Converting to Zip file
+cd $convertedSchematic/$username
+#sudo zip -rq -rm $zipname $filewithoutExt
+echo "Creating zip file of converted project">>$log
+zip -r $filewithoutExt{.zip,} 2>&1>>$log
+echo "The zip file is present at `pwd`">>$log
+cd $cwd
+rm -rf $convertedSchematic/$username/$filewithoutExt
+
+echo "###########End PSICE to KICAD Conversion#########################">>$log
+echo " ">>$log
+
+exit
+