Monday, December 01, 2014

A Full Featured Shell Script for a MOXA V2616A Industrial Router

For anyone who gets their hands on a MOXA v2616A Computer,  this script will update the system with the MOXA repos as well an ip subnet etc.
Change the IP and Default Gateway to suit your needs.

Copy and Paste the below script
Save the File to .sh 
Give the file execution permissions
Execute the script as root or with sudo

#!/bin/bash
ifconfig eth0 192.168.16.164
route add default gw 192.168.16.240
echo "nameserver 192.168.16.240" > /etc/resolv.conf
cd /opt
apt-get install -y unzip
wget http://www.moxa.com/drivers/UC/V2616A/V2616A-LX_V1.0_Utility_MOXA_SYS_DEB_KEY.zip
unzip V2616A-LX_V1.0_Utility_MOXA_SYS_DEB_KEY.zip
rm -rf V2615A-LX_V1.0_Utility_MOXA_SYS_DEB_KEY.zip
cd V2616A-LX_V1.0_Utility_MOXA_SYS_DEB_KEY
mv NEW-MOXA-SYS-DEBIAN-KEY NEW-MOXA-SYS-DEBIAN-KEY.gpg
apt-key add NEW-MOXA-SYS-DEBIAN-KEY.gpg
echo "#Moxa Repos" >> /etc/apt/sources.list
echo "deb http://debian.moxa.com/debian wheezy main" >> /etc/apt/sources.list
echo "#Backported packages for Debian 7 'Wheezy'" >> /etc/apt/sources.list
echo "deb http://http.debian.net/debian/ wheezy-backports main contrib" >> /etc/apt/sources.list
apt-get update
apt-get install -y linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
echo "#Virtual Box Repos"
echo "deb http://download.virtualbox.org/virtualbox/debian wheezy contrib" >> /etc/apt/sources.list
cd /opt
wget "http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc" >> /etc/apt/sources.list
apt-key add oracle_vbox.asc
apt-get update
apt-get -t wheezy-backports install virtualbox-4.3 curl git zsh -y
apt-get upgrade -y
curl -L http://install.ohmyz.sh | sh
chsh -s /bin/zsh






No comments:

Post a Comment