Skip to content

Instantly share code, notes, and snippets.

@ironmaniiith
Last active April 19, 2016 06:39
Show Gist options
  • Save ironmaniiith/f106c8885f7de0df7398 to your computer and use it in GitHub Desktop.
Save ironmaniiith/f106c8885f7de0df7398 to your computer and use it in GitHub Desktop.
Setup script while using live usb
cd
DIR=`pwd`
USER=`who | head -1 | cut -d " " -f1`
export http_proxy="http://proxy.iiit.ac.in:8080"
export https_proxy="http://proxy.iiit.ac.in:8080"
export ftp_proxy="http://proxy.iiit.ac.in:8080"
export socks_proxy="http://proxy.iiit.ac.in:8080"
export HTTP_PROXY="http://proxy.iiit.ac.in:8080"
export HTTPS_PROXY="http://proxy.iiit.ac.in:8080"
export FTP_PROXY="http://proxy.iiit.ac.in:8080"
export SOCKS_PROXY="http://proxy.iiit.ac.in:8080"
sudo -E apt-get update
function setEnvironment(){
# Set the environment here
echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:'$DIR/bin'"' > /etc/environment;
# sed -i -E 's|(PATH="[^"]*)|\1:/home/ubuntu-gnome/bin|g' /etc/environment
echo 'http_proxy="http://proxy.iiit.ac.in:8080"' >> /etc/environment;
echo 'HTTP_PROXY="http://proxy.iiit.ac.in:8080"' >> /etc/environment;
echo 'https_proxy="http://proxy.iiit.ac.in:8080"' >> /etc/environment;
echo 'HTTPS_PROXY="http://proxy.iiit.ac.in:8080"' >> /etc/environment;
echo 'ftp_proxy="http://proxy.iiit.ac.in:8080"' >> /etc/environment;
echo 'FTP_PROXY="http://proxy.iiit.ac.in:8080"' >> /etc/environment;
echo 'socks_proxy="http://proxy.iiit.ac.in:8080"' >> /etc/environment;
echo 'SOCKS_PROXY="http://proxy.iiit.ac.in:8080"' >> /etc/environment;
return 0;
}
function setOwnership(){
R='';
if [[ "$1" == "-r" || "$1" == "-R" ]]; then
R="-R";
fi
chown "$R" "$2" "$3"
chgrp "$R" "$2" "$3"
}
function installations(){
apt-get install -y git vim sl cowsay figlet fortune toilet python-mechanize python-bs4 python-pip python-pytest python-numpy ipython curl xdotool xbindkeys xclip parcellite;
return 0;
}
function getMyBin(){
# Check if bin is there or not, if not then clone
ls bin >/dev/null 2>/dev/null
if [[ $? -ne 0 ]]; then
git clone https://github.com/ironmaniiith/bin;
return 0;
fi
setOwnership -R "$USER" bin;
return 1;
}
function setBashRc(){
cat .bashrc | grep myAliases >/dev/null 2>/dev/null;
if [[ $? -eq 0 ]]; then
return 1;
fi
echo "export PATH=$PATH:"$DIR/bin:/usr/games >> .bashrc;
echo ". myAliases" >> .bashrc;
echo "# cp $DIR/bin/extras/terminal_profile/user $DIR/.config/dconf/user" >> .bashrc;
return 0;
}
function keyboardShortcuts(){
if ls .xbindkeysrc >/dev/null 2>/dev/null ; then
return 1;
else
touch .xbindkeysrc;
echo -e '# Open Firefox\n"firefox"\n control + alt + f\n' > .xbindkeysrc;
echo -e '# Kill python\n"killall python"\n control + alt + p\n' >> .xbindkeysrc;
echo "Make sure to run xbindkeys";
return 0;
fi
}
function installFlashPlayer(){
curl -L "https://fpdownload.adobe.com/get/flashplayer/pdc/11.2.202.569/install_flash_player_11_linux.x86_64.tar.gz" > /tmp/install_flash_player_11_linux.x86_64.tar.gz;
cd /tmp ;
tar -xvf /tmp/install_flash_player_11_linux.x86_64.tar.gz;
cp libflashplayer.so /usr/lib/mozilla/plugins/;
cd ;
}
function asciiAquarium(){
apt-get install -y libcurses-perl;
cd /tmp ;
wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz;
tar -zxvf Term-Animation-2.4.tar.gz;
cd Term-Animation-2.4/;
perl Makefile.PL && make && make test;
make install;
cd ;
}
function setTerminalProfile(){
cp "$DIR"/bin/extras/terminal_profile/user "$DIR"/.config/dconf/user;
}
function sublimeInstallation(){
# Check and install sublime
which subl >/dev/null 2>/dev/null;
if [[ "$?" -ne 0 ]]; then
git clone https://gist.github.com/8507139.git tmp/sublime_installation;
bash tmp/sublime_installation/*.sh;
return 0;
fi
return 1;
}
function gitinit(){
cd
if ls .git >/dev/null 2>/dev/null; then
return 1;
else
git init;
echo -e '.cache/*\n.local/*\n.bash_history\n.bash_logout\n.ICEauthority\n.xbindkeysrc\nbin/*\n.sudo_as_admin_successful\nDesktop' > .gitignore;
git add .;
return 0;
fi
setOwnership -R "$USER" .git;
}
# I need my tmp right now :P
mkdir -p $DIR/tmp
setOwnership -R "$USER" $DIR/tmp
setEnvironment;
installations;
getMyBin;
setBashRc;
keyboardShortcuts;
installFlashPlayer;
setTerminalProfile;
sublimeInstallation;
gitinit;
asciiAquarium;
# echo "Do you want to install asciiAquarium";
# read decision;
# if [[ "$decision" == "y" || "$decision" == "Y" ]]; then
# asciiAquarium;
# else
# sed -i "$DIR"/bin/asciiquarium "s/asciiquarium //g";
# fi
# echo "Do you want to setup the git repo for ~";
# read decision;
# if [[ "$decision" == "y" || "$decision" == "Y" ]]; then
# gitinit;
# fi
@ironmaniiith
Copy link
Author

Here is the shortened url for the source code
http://bit.do/livesetup

Also don't worry about the validity of the shortened url after editing this gist.
It will always give the latest edited gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment