diff --git a/app.js b/app.js
index 36a5f6b..fccdfea 100644
--- a/app.js
+++ b/app.js
@@ -11,6 +11,7 @@ var temperature = require('./routes/temperature');
var newpost = require('./routes/newpost');
var sensors = require('./routes/sensors');
var api = require('./routes/api');
+var upload = require('./routes/upload');
var mongoose = require('mongoose');
var mainLoop = require('./main');
@@ -43,6 +44,7 @@ app.use('/temperature', temperature);
app.use('/newpost', newpost);
app.use('/sensors', sensors);
app.use('/api', api);
+app.use('/upload', upload);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
diff --git a/public/html/navbar.html b/public/html/navbar.html
index 697ac0c..345aae5 100644
--- a/public/html/navbar.html
+++ b/public/html/navbar.html
@@ -28,6 +28,9 @@
+ -
+ File Upload
+
-
New Post
diff --git a/public/posts/1-4-2016.html b/public/posts/1-4-2016.html
index f26fc55..55894d3 100644
--- a/public/posts/1-4-2016.html
+++ b/public/posts/1-4-2016.html
@@ -18,7 +18,9 @@
Select your newly created droplet and navigate to console access. You will be prompted to change your password. Once the password is changed you can connect to the root user account via SSH.
- $ ssh root@<ip address>
+
+ $ ssh root@<ip address>
+
If you are using a Windows machine you can download putty to connect with SSH. If you choose not to use SSH you can just use the console access on the Digital Ocean website.
@@ -28,26 +30,34 @@
The very next thing I do is set up the firewall. I only want to open ports that need to be open. I use the built in firewall tool in Ubuntu called UFW.
- $ ufw enable
+
+ $ ufw enable
+
Now that UFW is enabled I can start opening the necessary ports. I must open 22 if I want to continue to SSH into the server.
- $ ufw allow 22/tcp
+
+ $ ufw allow 22/tcp
+
This will open TCP port 22 for SSH. I also open port 80 because that is the port in which the web server will run on.
Network Monitoring
- $ sudo apt-get install vnstat
+
+ $ sudo apt-get install vnstat
+
VNStat is a nice tool that will allow me to monitor the bandwidth my server consumes both outbound and inbound. Simply use the command "vnstat" to check the bandwidth. Note that it takes awhile for vnstat to capture bandwidth data if you just upon first installing it.
Terminal Multitasking
- $ sudo apt-get install screen
+
+ $ sudo apt-get install screen
+
Screen is a really nice tool too use when dealing with multiple terminal windows. Simply use the command $ screen to start screen. Press CTRL>A then C to open another screen window. Navigate between screens by pressing CTRL>A then N. To check if scren is attached or detached simply use the command $ screen -ls. Reattach to screen by using $ screen -r and detach with $ screen -d. If screen is open and already attached, but you wish to attach to it, simply use the command $ screen -d -r.
@@ -58,8 +68,8 @@
- $ sudo apt-get install npm
- $ sudo npm update npm -g
+ $ sudo apt-get install npm
+ $ sudo npm update npm -g
The package manager on ubuntu does not have the most recent NPM packge as of right now but it is very easy to update with NPM itself. The second command listed above will download the newest version of NPM and update itself.
@@ -89,22 +99,24 @@
- $ cd /etc/init.d
- $ sudo nano mongod
+ $ cd /etc/init.d
+ $ sudo nano mongod
Once here copy the contents of this file into mongod. We now have the startup script, but we need to change some permissions first before it can run.
- $ sudo chmod 755 /etc/init.d/mongod
- $ sudo chown root:root /etc/init.d/mongod
+ $ sudo chmod 755 /etc/init.d/mongod
+ $ sudo chown root:root /etc/init.d/mongod
And to run MongoDB upon system startup.
- $ update-rc.d mongod defaults
+
+ $ update-rc.d mongod defaults
+
Restoring Database Files
diff --git a/public/uploads/8-13-15.html b/public/uploads/8-13-15.html
new file mode 100644
index 0000000..cdca1a4
--- /dev/null
+++ b/public/uploads/8-13-15.html
@@ -0,0 +1,64 @@
+
+
+
ESP8266 - Cheap Wifi Microcontroller
+
+
August 13, 2015 by Mitchell
+
+
I've recently started playing around with microcontrollers, or more specifically arduinos. I have always had some projects in mind that require the use of some sort of microcontroller, most of which requred a wifi connection. There are a few wifi options availabe for the arduino, some of which can be very expensive. I eventually stumbled upon the ESP8266, which I have finally figured out... mostly.
+
+
+
+
+
Why the ESP8266?
+
+
It is extremely cheap! They can be found for roughly $3 apiece whereas the wifi arduino shield is around $70! I figured I would take my chances with the cheaper option and I ordered three of these. After frying two of these in process of trying to figure the darn things out, I ordered a 5 pack of the ESP-07 version. Banggood also sent me 7 of them which was a bonus.
+
+
Why the ESP-07 version?
+
+
The ESP8266 can be programmed as a stand alone device with the Arduino IDE! That's right, you don't even need an arduino! Also, most of the arduino libraries work with it! I went this direction after exeriencing many frustrations using the ESP8266 in conjunction with an arduino. The ESP-07 version has more GPIO pins and is about the same price, whereas the ESP-01 only has two GPIO pins, one of which much be grounded to program the device.
+
+
+
First experiences with the ESP8266
+
After playing around with this microcontroller for some time now, I have concluded that it can be finicky at times. Documentation for the device can also be difficult to find, especially if you run into problems. I am going to discuss what I went through to finally get the device fully working, along with the frustrations that I experienced.
+
+
+
When you first get the device, make sure to have solid connections to each one of the pins. You will need an FTDI programmer to connect to USB. This is the one that I have and it works fine. Just make sure you have one that is 3.3v capable or it will not work! The ESP8266 can draw over 200 mA at times and the FTDI programmer simply does not provide enough power. This is the power supply I used.
+
+
+
Wiring
+
Wiring is pretty much the same across different versions of the ESP8266. Connect VCC and CH_PD to power at all times. Gnd to gnd and on the ESP-07 GPIO15 must also go to gnd. When you program the device, you must have GPIO0 to ground for programming mode. You must also connect RX on the ESP8266 to TX on the FTDI programmer and vice versa. Make sure to connect all of the power and ground wires to the power supply and NOT the FTDI programmer. The only two wires you should have connected to the FTDI programmer are RX and TX.
+
+
+
Testing the ESP8266
+
To test out the device, plug it into your computer and use a serial monitor. You can use the arduino serial monitor, or you can also use putty. Make sure to select the correct COM port and the right baud rate. Baud rates can vary. I have had some that are 9600 and others have been 115200. Just change the baud rate until you see text that you can actually read. Once connected, you can change the baud rate of the ESP8266.
+
+
There is a set of AT commands to communicate with the ESP8266. The documentation of these commands is descent although some commands were a bit hard to find. Here is a list of most of the commands. A few important commands that are often missed are to change the baud rate and update the firmware on the device. You can update the firmware by using AT+CIUPDATE. You can also change the baud rate by using AT+CIOBAUD=9600, or whatever baud rate you desire.
+
+
+
These commands can be used to test the ESP8266, but they are also the same commands if you wanted to use it with an arduino. Simply wire it up to serial on an arduino and print out the commands. I played around with this for a bit, but not long enough to get it fully working. This is how I was originally going to use the device, but I found it to be much easier programming the ESP8266 directly as a standalone device.
+
+
+
Programming ESP8266 with Arduino IDE
+
A major advantage of programming the ESP8266 is that it is more powerful, yet much smaller in size. It uses a 32 bit processor and also has 1mb of ram (on the newer versions). Link to Github ESP8266 Arduino IDE. You can install this in your Arduino IDE by File > preferences and adding http://arduino.esp8266.com/package_esp8266com_index.json to Additional Boards Manager URLs. Now you can go to Sketch > Libraries > Manage Libraries and add the ESP8266 library.
+
+
+
Select an example sketch (WIFIScan) and make sure your ESP8266 is plugged in with GPIO0 to ground! It must be to ground to enter programming mode! Select Generic ESP8266 Module for the board and the right port. It shouldn't matter which programmer is selected. Compile and upload your sketch and it is as simple as that!
+
+
+
Complications
+
I just want to reiterate some of my complications that I ran into throughout this process. The biggest thing to keep in mind it to check your connections! The first time I soldered all of the connections I couldn't figure out why it wasn't working. I checked each connection with a meter only to find out one of them was bad. Another thing is to make sure you use an external power supply! Connect all power and ground connections to these! Also connect the ground of your FTDI programmer to the ground of your power supply. Make sure the voltage of your power supply and FTDI programmer are 3.3v! Remember to connect GPIO0 to ground ONLY when uploading to the ESP8266.
+
+
Sources
+
+
https://www.sparkfun.com/products/13678
+
+
http://www.esp8266.com/
+
+
https://github.com/esp8266/Arduino
+
+
http://www.pridopia.co.uk/pi-doc/ESP8266ATCommandsSet.pdf
+
+
https://nurdspace.nl/ESP8266
+
+
http://www.electrodragon.com/w/ESP8266
+
\ No newline at end of file
diff --git a/public/uploads/Screenshot from 2015-12-18 12:52:46.png b/public/uploads/Screenshot from 2015-12-18 12:52:46.png
new file mode 100644
index 0000000..7008adc
Binary files /dev/null and b/public/uploads/Screenshot from 2015-12-18 12:52:46.png differ
diff --git a/public/uploads/sunset.jpg b/public/uploads/sunset.jpg
new file mode 100644
index 0000000..352000e
Binary files /dev/null and b/public/uploads/sunset.jpg differ
diff --git a/public/uploads/vpnsetup.2.sh b/public/uploads/vpnsetup.2.sh
new file mode 100644
index 0000000..c2c6ce3
--- /dev/null
+++ b/public/uploads/vpnsetup.2.sh
@@ -0,0 +1,13948 @@
+#!/bin/sh
+#
+
+BASH_BASE_SIZE=0x00000000
+CISCO_AC_TIMESTAMP=0x0000000000000000
+# BASH_BASE_SIZE=0x00000000 is required for signing
+# CISCO_AC_TIMESTAMP is also required for signing
+# comment is after BASH_BASE_SIZE or else sign tool will find the comment
+
+LEGACY_INSTPREFIX=/opt/cisco/vpn
+LEGACY_BINDIR=${LEGACY_INSTPREFIX}/bin
+LEGACY_UNINST=${LEGACY_BINDIR}/vpn_uninstall.sh
+
+TARROOT="vpn"
+INSTPREFIX=/opt/cisco/anyconnect
+ROOTCERTSTORE=/opt/.cisco/certificates/ca
+ROOTCACERT="VeriSignClass3PublicPrimaryCertificationAuthority-G5.pem"
+INIT_SRC="vpnagentd_init"
+INIT="vpnagentd"
+BINDIR=${INSTPREFIX}/bin
+LIBDIR=${INSTPREFIX}/lib
+PROFILEDIR=${INSTPREFIX}/profile
+SCRIPTDIR=${INSTPREFIX}/script
+HELPDIR=${INSTPREFIX}/help
+PLUGINDIR=${BINDIR}/plugins
+UNINST=${BINDIR}/vpn_uninstall.sh
+INSTALL=install
+SYSVSTART="S85"
+SYSVSTOP="K25"
+SYSVLEVELS="2 3 4 5"
+PREVDIR=`pwd`
+MARKER=$((`grep -an "[B]EGIN\ ARCHIVE" $0 | cut -d ":" -f 1` + 1))
+MARKER_END=$((`grep -an "[E]ND\ ARCHIVE" $0 | cut -d ":" -f 1` - 1))
+LOGFNAME=`date "+anyconnect-linux-64-3.1.08009-k9-%H%M%S%d%m%Y.log"`
+CLIENTNAME="Cisco AnyConnect Secure Mobility Client"
+FEEDBACK_DIR="${INSTPREFIX}/CustomerExperienceFeedback"
+
+echo "Installing ${CLIENTNAME}..."
+echo "Installing ${CLIENTNAME}..." > /tmp/${LOGFNAME}
+echo `whoami` "invoked $0 from " `pwd` " at " `date` >> /tmp/${LOGFNAME}
+
+# Make sure we are root
+if [ `id | sed -e 's/(.*//'` != "uid=0" ]; then
+ echo "Sorry, you need super user privileges to run this script."
+ exit 1
+fi
+## The web-based installer used for VPN client installation and upgrades does
+## not have the license.txt in the current directory, intentionally skipping
+## the license agreement. Bug CSCtc45589 has been filed for this behavior.
+if [ -f "license.txt" ]; then
+ cat ./license.txt
+ echo
+ echo -n "Do you accept the terms in the license agreement? [y/n] "
+ read LICENSEAGREEMENT
+ while :
+ do
+ case ${LICENSEAGREEMENT} in
+ [Yy][Ee][Ss])
+ echo "You have accepted the license agreement."
+ echo "Please wait while ${CLIENTNAME} is being installed..."
+ break
+ ;;
+ [Yy])
+ echo "You have accepted the license agreement."
+ echo "Please wait while ${CLIENTNAME} is being installed..."
+ break
+ ;;
+ [Nn][Oo])
+ echo "The installation was cancelled because you did not accept the license agreement."
+ exit 1
+ ;;
+ [Nn])
+ echo "The installation was cancelled because you did not accept the license agreement."
+ exit 1
+ ;;
+ *)
+ echo "Please enter either \"y\" or \"n\"."
+ read LICENSEAGREEMENT
+ ;;
+ esac
+ done
+fi
+if [ "`basename $0`" != "vpn_install.sh" ]; then
+ if which mktemp >/dev/null 2>&1; then
+ TEMPDIR=`mktemp -d /tmp/vpn.XXXXXX`
+ RMTEMP="yes"
+ else
+ TEMPDIR="/tmp"
+ RMTEMP="no"
+ fi
+else
+ TEMPDIR="."
+fi
+
+#
+# Check for and uninstall any previous version.
+#
+if [ -x "${LEGACY_UNINST}" ]; then
+ echo "Removing previous installation..."
+ echo "Removing previous installation: "${LEGACY_UNINST} >> /tmp/${LOGFNAME}
+ STATUS=`${LEGACY_UNINST}`
+ if [ "${STATUS}" ]; then
+ echo "Error removing previous installation! Continuing..." >> /tmp/${LOGFNAME}
+ fi
+
+ # migrate the /opt/cisco/vpn directory to /opt/cisco/anyconnect directory
+ echo "Migrating ${LEGACY_INSTPREFIX} directory to ${INSTPREFIX} directory" >> /tmp/${LOGFNAME}
+
+ ${INSTALL} -d ${INSTPREFIX}
+
+ # local policy file
+ if [ -f "${LEGACY_INSTPREFIX}/AnyConnectLocalPolicy.xml" ]; then
+ mv -f ${LEGACY_INSTPREFIX}/AnyConnectLocalPolicy.xml ${INSTPREFIX}/ >/dev/null 2>&1
+ fi
+
+ # global preferences
+ if [ -f "${LEGACY_INSTPREFIX}/.anyconnect_global" ]; then
+ mv -f ${LEGACY_INSTPREFIX}/.anyconnect_global ${INSTPREFIX}/ >/dev/null 2>&1
+ fi
+
+ # logs
+ mv -f ${LEGACY_INSTPREFIX}/*.log ${INSTPREFIX}/ >/dev/null 2>&1
+
+ # VPN profiles
+ if [ -d "${LEGACY_INSTPREFIX}/profile" ]; then
+ ${INSTALL} -d ${INSTPREFIX}/profile
+ tar cf - -C ${LEGACY_INSTPREFIX}/profile . | (cd ${INSTPREFIX}/profile; tar xf -)
+ rm -rf ${LEGACY_INSTPREFIX}/profile
+ fi
+
+ # VPN scripts
+ if [ -d "${LEGACY_INSTPREFIX}/script" ]; then
+ ${INSTALL} -d ${INSTPREFIX}/script
+ tar cf - -C ${LEGACY_INSTPREFIX}/script . | (cd ${INSTPREFIX}/script; tar xf -)
+ rm -rf ${LEGACY_INSTPREFIX}/script
+ fi
+
+ # localization
+ if [ -d "${LEGACY_INSTPREFIX}/l10n" ]; then
+ ${INSTALL} -d ${INSTPREFIX}/l10n
+ tar cf - -C ${LEGACY_INSTPREFIX}/l10n . | (cd ${INSTPREFIX}/l10n; tar xf -)
+ rm -rf ${LEGACY_INSTPREFIX}/l10n
+ fi
+elif [ -x "${UNINST}" ]; then
+ echo "Removing previous installation..."
+ echo "Removing previous installation: "${UNINST} >> /tmp/${LOGFNAME}
+ STATUS=`${UNINST}`
+ if [ "${STATUS}" ]; then
+ echo "Error removing previous installation! Continuing..." >> /tmp/${LOGFNAME}
+ fi
+fi
+
+if [ "${TEMPDIR}" != "." ]; then
+ TARNAME=`date +%N`
+ TARFILE=${TEMPDIR}/vpninst${TARNAME}.tgz
+
+ echo "Extracting installation files to ${TARFILE}..."
+ echo "Extracting installation files to ${TARFILE}..." >> /tmp/${LOGFNAME}
+ # "head --bytes=-1" used to remove '\n' prior to MARKER_END
+ head -n ${MARKER_END} $0 | tail -n +${MARKER} | head --bytes=-1 2>> /tmp/${LOGFNAME} > ${TARFILE} || exit 1
+
+ echo "Unarchiving installation files to ${TEMPDIR}..."
+ echo "Unarchiving installation files to ${TEMPDIR}..." >> /tmp/${LOGFNAME}
+ tar xvzf ${TARFILE} -C ${TEMPDIR} >> /tmp/${LOGFNAME} 2>&1 || exit 1
+
+ rm -f ${TARFILE}
+
+ NEWTEMP="${TEMPDIR}/${TARROOT}"
+else
+ NEWTEMP="."
+fi
+
+# Make sure destination directories exist
+echo "Installing "${BINDIR} >> /tmp/${LOGFNAME}
+${INSTALL} -d ${BINDIR} || exit 1
+echo "Installing "${LIBDIR} >> /tmp/${LOGFNAME}
+${INSTALL} -d ${LIBDIR} || exit 1
+echo "Installing "${PROFILEDIR} >> /tmp/${LOGFNAME}
+${INSTALL} -d ${PROFILEDIR} || exit 1
+echo "Installing "${SCRIPTDIR} >> /tmp/${LOGFNAME}
+${INSTALL} -d ${SCRIPTDIR} || exit 1
+echo "Installing "${HELPDIR} >> /tmp/${LOGFNAME}
+${INSTALL} -d ${HELPDIR} || exit 1
+echo "Installing "${PLUGINDIR} >> /tmp/${LOGFNAME}
+${INSTALL} -d ${PLUGINDIR} || exit 1
+echo "Installing "${ROOTCERTSTORE} >> /tmp/${LOGFNAME}
+${INSTALL} -d ${ROOTCERTSTORE} || exit 1
+
+# Copy files to their home
+echo "Installing "${NEWTEMP}/${ROOTCACERT} >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 444 ${NEWTEMP}/${ROOTCACERT} ${ROOTCERTSTORE} || exit 1
+
+echo "Installing "${NEWTEMP}/vpn_uninstall.sh >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/vpn_uninstall.sh ${BINDIR} || exit 1
+
+echo "Creating symlink "${BINDIR}/vpn_uninstall.sh >> /tmp/${LOGFNAME}
+mkdir -p ${LEGACY_BINDIR}
+ln -s ${BINDIR}/vpn_uninstall.sh ${LEGACY_BINDIR}/vpn_uninstall.sh || exit 1
+chmod 755 ${LEGACY_BINDIR}/vpn_uninstall.sh
+
+echo "Installing "${NEWTEMP}/anyconnect_uninstall.sh >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/anyconnect_uninstall.sh ${BINDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/vpnagentd >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/vpnagentd ${BINDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/libvpnagentutilities.so >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/libvpnagentutilities.so ${LIBDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/libvpncommon.so >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/libvpncommon.so ${LIBDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/libvpncommoncrypt.so >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/libvpncommoncrypt.so ${LIBDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/libvpnapi.so >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/libvpnapi.so ${LIBDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/libacciscossl.so >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/libacciscossl.so ${LIBDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/libacciscocrypto.so >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/libacciscocrypto.so ${LIBDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/libaccurl.so.4.3.0 >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/libaccurl.so.4.3.0 ${LIBDIR} || exit 1
+
+echo "Creating symlink "${NEWTEMP}/libaccurl.so.4 >> /tmp/${LOGFNAME}
+ln -s ${LIBDIR}/libaccurl.so.4.3.0 ${LIBDIR}/libaccurl.so.4 || exit 1
+
+if [ -f "${NEWTEMP}/libvpnipsec.so" ]; then
+ echo "Installing "${NEWTEMP}/libvpnipsec.so >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 755 ${NEWTEMP}/libvpnipsec.so ${PLUGINDIR} || exit 1
+else
+ echo "${NEWTEMP}/libvpnipsec.so does not exist. It will not be installed."
+fi
+
+if [ -f "${NEWTEMP}/libacfeedback.so" ]; then
+ echo "Installing "${NEWTEMP}/libacfeedback.so >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 755 ${NEWTEMP}/libacfeedback.so ${PLUGINDIR} || exit 1
+else
+ echo "${NEWTEMP}/libacfeedback.so does not exist. It will not be installed."
+fi
+
+if [ -f "${NEWTEMP}/vpnui" ]; then
+ echo "Installing "${NEWTEMP}/vpnui >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 755 ${NEWTEMP}/vpnui ${BINDIR} || exit 1
+else
+ echo "${NEWTEMP}/vpnui does not exist. It will not be installed."
+fi
+
+echo "Installing "${NEWTEMP}/vpn >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 755 ${NEWTEMP}/vpn ${BINDIR} || exit 1
+
+if [ -d "${NEWTEMP}/pixmaps" ]; then
+ echo "Copying pixmaps" >> /tmp/${LOGFNAME}
+ cp -R ${NEWTEMP}/pixmaps ${INSTPREFIX}
+else
+ echo "pixmaps not found... Continuing with the install."
+fi
+
+if [ -f "${NEWTEMP}/cisco-anyconnect.menu" ]; then
+ echo "Installing ${NEWTEMP}/cisco-anyconnect.menu" >> /tmp/${LOGFNAME}
+ mkdir -p /etc/xdg/menus/applications-merged || exit
+ # there may be an issue where the panel menu doesn't get updated when the applications-merged
+ # folder gets created for the first time.
+ # This is an ubuntu bug. https://bugs.launchpad.net/ubuntu/+source/gnome-panel/+bug/369405
+
+ ${INSTALL} -o root -m 644 ${NEWTEMP}/cisco-anyconnect.menu /etc/xdg/menus/applications-merged/
+else
+ echo "${NEWTEMP}/anyconnect.menu does not exist. It will not be installed."
+fi
+
+
+if [ -f "${NEWTEMP}/cisco-anyconnect.directory" ]; then
+ echo "Installing ${NEWTEMP}/cisco-anyconnect.directory" >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 644 ${NEWTEMP}/cisco-anyconnect.directory /usr/share/desktop-directories/
+else
+ echo "${NEWTEMP}/anyconnect.directory does not exist. It will not be installed."
+fi
+
+# if the update cache utility exists then update the menu cache
+# otherwise on some gnome systems, the short cut will disappear
+# after user logoff or reboot. This is neccessary on some
+# gnome desktops(Ubuntu 10.04)
+if [ -f "${NEWTEMP}/cisco-anyconnect.desktop" ]; then
+ echo "Installing ${NEWTEMP}/cisco-anyconnect.desktop" >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 644 ${NEWTEMP}/cisco-anyconnect.desktop /usr/share/applications/
+ if [ -x "/usr/share/gnome-menus/update-gnome-menus-cache" ]; then
+ for CACHE_FILE in $(ls /usr/share/applications/desktop.*.cache); do
+ echo "updating ${CACHE_FILE}" >> /tmp/${LOGFNAME}
+ /usr/share/gnome-menus/update-gnome-menus-cache /usr/share/applications/ > ${CACHE_FILE}
+ done
+ fi
+else
+ echo "${NEWTEMP}/anyconnect.desktop does not exist. It will not be installed."
+fi
+
+if [ -f "${NEWTEMP}/ACManifestVPN.xml" ]; then
+ echo "Installing "${NEWTEMP}/ACManifestVPN.xml >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 444 ${NEWTEMP}/ACManifestVPN.xml ${INSTPREFIX} || exit 1
+else
+ echo "${NEWTEMP}/ACManifestVPN.xml does not exist. It will not be installed."
+fi
+
+if [ -f "${NEWTEMP}/manifesttool" ]; then
+ echo "Installing "${NEWTEMP}/manifesttool >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 755 ${NEWTEMP}/manifesttool ${BINDIR} || exit 1
+
+ # create symlinks for legacy install compatibility
+ ${INSTALL} -d ${LEGACY_BINDIR}
+
+ echo "Creating manifesttool symlink for legacy install compatibility." >> /tmp/${LOGFNAME}
+ ln -f -s ${BINDIR}/manifesttool ${LEGACY_BINDIR}/manifesttool
+else
+ echo "${NEWTEMP}/manifesttool does not exist. It will not be installed."
+fi
+
+
+if [ -f "${NEWTEMP}/update.txt" ]; then
+ echo "Installing "${NEWTEMP}/update.txt >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 444 ${NEWTEMP}/update.txt ${INSTPREFIX} || exit 1
+
+ # create symlinks for legacy weblaunch compatibility
+ ${INSTALL} -d ${LEGACY_INSTPREFIX}
+
+ echo "Creating update.txt symlink for legacy weblaunch compatibility." >> /tmp/${LOGFNAME}
+ ln -s ${INSTPREFIX}/update.txt ${LEGACY_INSTPREFIX}/update.txt
+else
+ echo "${NEWTEMP}/update.txt does not exist. It will not be installed."
+fi
+
+
+if [ -f "${NEWTEMP}/vpndownloader" ]; then
+ # cached downloader
+ echo "Installing "${NEWTEMP}/vpndownloader >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 755 ${NEWTEMP}/vpndownloader ${BINDIR} || exit 1
+
+ # create symlinks for legacy weblaunch compatibility
+ ${INSTALL} -d ${LEGACY_BINDIR}
+
+ echo "Creating vpndownloader.sh script for legacy weblaunch compatibility." >> /tmp/${LOGFNAME}
+ echo "ERRVAL=0" > ${LEGACY_BINDIR}/vpndownloader.sh
+ echo ${BINDIR}/"vpndownloader \"\$*\" || ERRVAL=\$?" >> ${LEGACY_BINDIR}/vpndownloader.sh
+ echo "exit \${ERRVAL}" >> ${LEGACY_BINDIR}/vpndownloader.sh
+ chmod 444 ${LEGACY_BINDIR}/vpndownloader.sh
+
+ echo "Creating vpndownloader symlink for legacy weblaunch compatibility." >> /tmp/${LOGFNAME}
+ ln -s ${BINDIR}/vpndownloader ${LEGACY_BINDIR}/vpndownloader
+else
+ echo "${NEWTEMP}/vpndownloader does not exist. It will not be installed."
+fi
+
+if [ -f "${NEWTEMP}/vpndownloader-cli" ]; then
+ # cached downloader (cli)
+ echo "Installing "${NEWTEMP}/vpndownloader-cli >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 755 ${NEWTEMP}/vpndownloader-cli ${BINDIR} || exit 1
+else
+ echo "${NEWTEMP}/vpndownloader-cli does not exist. It will not be installed."
+fi
+
+
+# Open source information
+echo "Installing "${NEWTEMP}/OpenSource.html >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 444 ${NEWTEMP}/OpenSource.html ${INSTPREFIX} || exit 1
+
+# Profile schema
+echo "Installing "${NEWTEMP}/AnyConnectProfile.xsd >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 444 ${NEWTEMP}/AnyConnectProfile.xsd ${PROFILEDIR} || exit 1
+
+echo "Installing "${NEWTEMP}/AnyConnectLocalPolicy.xsd >> /tmp/${LOGFNAME}
+${INSTALL} -o root -m 444 ${NEWTEMP}/AnyConnectLocalPolicy.xsd ${INSTPREFIX} || exit 1
+
+# Import any AnyConnect XML profiles side by side vpn install directory (in well known Profiles/vpn directory)
+# Also import the AnyConnectLocalPolicy.xml file (if present)
+# If failure occurs here then no big deal, don't exit with error code
+# only copy these files if tempdir is . which indicates predeploy
+
+INSTALLER_FILE_DIR=$(dirname "$0")
+
+IS_PRE_DEPLOY=true
+
+if [ "${TEMPDIR}" != "." ]; then
+ IS_PRE_DEPLOY=false;
+fi
+
+if $IS_PRE_DEPLOY; then
+ PROFILE_IMPORT_DIR="${INSTALLER_FILE_DIR}/../Profiles"
+ VPN_PROFILE_IMPORT_DIR="${INSTALLER_FILE_DIR}/../Profiles/vpn"
+
+ if [ -d ${PROFILE_IMPORT_DIR} ]; then
+ find ${PROFILE_IMPORT_DIR} -maxdepth 1 -name "AnyConnectLocalPolicy.xml" -type f -exec ${INSTALL} -o root -m 644 {} ${INSTPREFIX} \;
+ fi
+
+ if [ -d ${VPN_PROFILE_IMPORT_DIR} ]; then
+ find ${VPN_PROFILE_IMPORT_DIR} -maxdepth 1 -name "*.xml" -type f -exec ${INSTALL} -o root -m 644 {} ${PROFILEDIR} \;
+ fi
+fi
+
+# Process transforms
+# API to get the value of the tag from the transforms file
+# The Third argument will be used to check if the tag value needs to converted to lowercase
+getProperty()
+{
+ FILE=${1}
+ TAG=${2}
+ TAG_FROM_FILE=$(grep ${TAG} "${FILE}" | sed "s/\(.*\)\(<${TAG}>\)\(.*\)\(<\/${TAG}>\)\(.*\)/\3/")
+ if [ "${3}" = "true" ]; then
+ TAG_FROM_FILE=`echo ${TAG_FROM_FILE} | tr '[:upper:]' '[:lower:]'`
+ fi
+ echo $TAG_FROM_FILE;
+}
+
+DISABLE_FEEDBACK_TAG="DisableCustomerExperienceFeedback"
+
+if $IS_PRE_DEPLOY; then
+ if [ -d "${PROFILE_IMPORT_DIR}" ]; then
+ TRANSFORM_FILE="${PROFILE_IMPORT_DIR}/ACTransforms.xml"
+ fi
+else
+ TRANSFORM_FILE="${INSTALLER_FILE_DIR}/ACTransforms.xml"
+fi
+
+#get the tag values from the transform file
+if [ -f "${TRANSFORM_FILE}" ] ; then
+ echo "Processing transform file in ${TRANSFORM_FILE}"
+ DISABLE_FEEDBACK=$(getProperty "${TRANSFORM_FILE}" ${DISABLE_FEEDBACK_TAG} "true" )
+fi
+
+# if disable phone home is specified, remove the phone home plugin and any data folder
+# note: this will remove the customer feedback profile if it was imported above
+FEEDBACK_PLUGIN="${PLUGINDIR}/libacfeedback.so"
+
+if [ "x${DISABLE_FEEDBACK}" = "xtrue" ] ; then
+ echo "Disabling Customer Experience Feedback plugin"
+ rm -f ${FEEDBACK_PLUGIN}
+ rm -rf ${FEEDBACK_DIR}
+fi
+
+
+# Attempt to install the init script in the proper place
+
+# Find out if we are using chkconfig
+if [ -e "/sbin/chkconfig" ]; then
+ CHKCONFIG="/sbin/chkconfig"
+elif [ -e "/usr/sbin/chkconfig" ]; then
+ CHKCONFIG="/usr/sbin/chkconfig"
+else
+ CHKCONFIG="chkconfig"
+fi
+if [ `${CHKCONFIG} --list 2> /dev/null | wc -l` -lt 1 ]; then
+ CHKCONFIG=""
+ echo "(chkconfig not found or not used)" >> /tmp/${LOGFNAME}
+fi
+
+# Locate the init script directory
+if [ -d "/etc/init.d" ]; then
+ INITD="/etc/init.d"
+elif [ -d "/etc/rc.d/init.d" ]; then
+ INITD="/etc/rc.d/init.d"
+else
+ INITD="/etc/rc.d"
+fi
+
+# BSD-style init scripts on some distributions will emulate SysV-style.
+if [ "x${CHKCONFIG}" = "x" ]; then
+ if [ -d "/etc/rc.d" -o -d "/etc/rc0.d" ]; then
+ BSDINIT=1
+ if [ -d "/etc/rc.d" ]; then
+ RCD="/etc/rc.d"
+ else
+ RCD="/etc"
+ fi
+ fi
+fi
+
+if [ "x${INITD}" != "x" ]; then
+ echo "Installing "${NEWTEMP}/${INIT_SRC} >> /tmp/${LOGFNAME}
+ echo ${INSTALL} -o root -m 755 ${NEWTEMP}/${INIT_SRC} ${INITD}/${INIT} >> /tmp/${LOGFNAME}
+ ${INSTALL} -o root -m 755 ${NEWTEMP}/${INIT_SRC} ${INITD}/${INIT} || exit 1
+ if [ "x${CHKCONFIG}" != "x" ]; then
+ echo ${CHKCONFIG} --add ${INIT} >> /tmp/${LOGFNAME}
+ ${CHKCONFIG} --add ${INIT}
+ else
+ if [ "x${BSDINIT}" != "x" ]; then
+ for LEVEL in ${SYSVLEVELS}; do
+ DIR="rc${LEVEL}.d"
+ if [ ! -d "${RCD}/${DIR}" ]; then
+ mkdir ${RCD}/${DIR}
+ chmod 755 ${RCD}/${DIR}
+ fi
+ ln -sf ${INITD}/${INIT} ${RCD}/${DIR}/${SYSVSTART}${INIT}
+ ln -sf ${INITD}/${INIT} ${RCD}/${DIR}/${SYSVSTOP}${INIT}
+ done
+ fi
+ fi
+
+ echo "Starting ${CLIENTNAME} Agent..."
+ echo "Starting ${CLIENTNAME} Agent..." >> /tmp/${LOGFNAME}
+ # Attempt to start up the agent
+ echo ${INITD}/${INIT} start >> /tmp/${LOGFNAME}
+ logger "Starting ${CLIENTNAME} Agent..."
+ ${INITD}/${INIT} start >> /tmp/${LOGFNAME} || exit 1
+
+fi
+
+# Generate/update the VPNManifest.dat file
+if [ -f ${BINDIR}/manifesttool ]; then
+ ${BINDIR}/manifesttool -i ${INSTPREFIX} ${INSTPREFIX}/ACManifestVPN.xml
+fi
+
+
+if [ "${RMTEMP}" = "yes" ]; then
+ echo rm -rf ${TEMPDIR} >> /tmp/${LOGFNAME}
+ rm -rf ${TEMPDIR}
+fi
+
+echo "Done!"
+echo "Done!" >> /tmp/${LOGFNAME}
+
+# move the logfile out of the tmp directory
+mv /tmp/${LOGFNAME} ${INSTPREFIX}/.
+
+exit 0
+
+--BEGIN ARCHIVE--
+ '5U