-cp ../sanitytest/target/sanitytest-0.4.1-SNAPSHOT.jar ./target/distribution.opendaylight-osgipackage/opendaylight/plugins
-pushd ./target/distribution.opendaylight-osgipackage/opendaylight/
+# Inject the sanitytest jar as a controller plugin
+cp ./target/dependency/sanitytest*.jar ./target/distribution.opendaylight-osgipackage/opendaylight/plugins
+
+# Store the current working directory in a variable so that we can get back to it later
+cwd=`pwd`
+
+# Switch to the distribution folder
+cd ./target/distribution.opendaylight-osgipackage/opendaylight/
+
+# Run the controller