sandbox/run.sh

238 lines
4.8 KiB
Bash
Raw Permalink Normal View History

2016-04-08 11:43:57 +00:00
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
2019-08-04 10:12:26 +00:00
USERNAME="sneak"
2016-04-08 11:43:57 +00:00
set -x
2019-08-03 23:22:25 +00:00
set -e
2016-04-08 12:36:49 +00:00
exec 1> >(tee -a /var/log/sandboxbuild.log) 2>&1
2016-04-08 11:43:57 +00:00
PKGS="
2019-08-03 23:22:25 +00:00
apt-transport-https
2016-04-08 11:43:57 +00:00
apt-utils
2019-08-03 23:22:25 +00:00
aspell
aspell-en
automake
bash-completion
2019-08-03 23:22:25 +00:00
bc
2016-08-26 23:51:06 +00:00
bind9-host
2016-04-08 11:43:57 +00:00
bonnie++
build-essential
byobu
2019-08-03 23:22:25 +00:00
cmake
2016-04-08 11:43:57 +00:00
command-not-found
2019-08-03 23:22:25 +00:00
curl
2016-04-08 11:43:57 +00:00
daemontools
debmirror
default-jre
2019-08-03 23:22:25 +00:00
diffstat
dnsutils
2019-08-04 09:19:48 +00:00
docker.io
2019-08-03 23:22:25 +00:00
dos2unix
editorconfig
ffmpeg
2016-04-08 11:43:57 +00:00
fonts-indic
fonts-ipafont-gothic
fonts-ipafont-mincho
fortune
git
2019-08-03 23:22:25 +00:00
gnupg-agent
gnupg2
golang-go
2019-08-03 23:22:25 +00:00
host
imagemagick
iputils-ping
2016-04-08 11:43:57 +00:00
irssi
jq
2019-08-03 23:22:25 +00:00
lcov
2016-04-08 11:43:57 +00:00
ldap-auth-client
ldap-utils
2019-08-03 23:22:25 +00:00
libasound2
libatk1.0-0
2017-08-05 11:34:41 +00:00
libboost-all-dev
libdb++-dev
2019-08-03 23:22:25 +00:00
libgconf-2-4
libgtk-3-0
libjpeg-dev
2016-04-08 11:43:57 +00:00
libnss-mdns
2019-08-03 23:22:25 +00:00
libnss3
libpng-dev
libssl-dev
libtool
libxcursor1
2016-04-08 11:43:57 +00:00
libxml2
libxml2-dev
libxslt1-dev
2019-08-03 23:22:25 +00:00
locales
2016-04-08 11:43:57 +00:00
lsof
mailutils
make
2019-08-03 23:22:25 +00:00
man
2016-04-08 11:43:57 +00:00
man-db
2019-08-03 23:22:25 +00:00
mercurial
2016-04-08 11:43:57 +00:00
mosh
mutt
netcat-openbsd
2016-04-08 11:43:57 +00:00
nmap
nscd
2016-08-26 23:51:06 +00:00
openssh-server
2019-08-03 23:22:25 +00:00
pass
2016-04-08 11:43:57 +00:00
pbzip2
2019-08-03 23:22:25 +00:00
pinentry-curses
2017-08-05 11:34:41 +00:00
pkg-config
2019-08-03 23:22:25 +00:00
pkg-config
psmisc
2016-04-08 11:43:57 +00:00
pv
pwgen
python
2019-08-03 23:22:25 +00:00
python3
2016-04-08 11:43:57 +00:00
python-dev
2019-08-03 23:22:25 +00:00
python3-dev
2016-04-08 11:43:57 +00:00
python-pip
2019-08-03 23:22:25 +00:00
python3-pip
2016-04-08 11:43:57 +00:00
rbenv
rsync
rsyslog
rsyslog-gnutls
rsyslog-relp
runit
screen
snmp
snmpd
software-properties-common
2019-08-03 23:22:25 +00:00
strace
sudo
tcpdump
2016-04-08 11:43:57 +00:00
telnet
texlive-latex-base
tmux
2019-08-03 23:22:25 +00:00
tree
2016-04-08 11:43:57 +00:00
ttf-wqy-microhei
ttf-wqy-zenhei
vagrant
vim
2019-08-03 23:22:25 +00:00
vim-gtk
2016-04-08 11:43:57 +00:00
wamerican-insane
wget
2019-08-03 23:22:25 +00:00
xterm
zip
2016-04-08 11:43:57 +00:00
"
2019-08-03 23:22:25 +00:00
apt update
apt -y upgrade
apt install -y $PKGS
# install neovim
2016-04-08 11:43:57 +00:00
add-apt-repository ppa:neovim-ppa/unstable
2019-08-03 23:22:25 +00:00
apt update
apt install -y neovim
2016-04-08 11:43:57 +00:00
2019-08-03 23:22:25 +00:00
mkdir -p /etc/bashrc.d
2019-08-05 02:02:42 +00:00
mkdir -p /etc/profile.d
cat >> /etc/bash.bashrc <<'EOF'
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
2019-08-03 23:22:25 +00:00
for FN in /etc/bashrc.d/*.sh; do
source "$FN"
done
2019-08-05 02:02:42 +00:00
if ! shopt -oq posix; then
for FN in /etc/profile.d/*.sh; do
source "$FN"
done
fi
2019-08-03 23:22:25 +00:00
EOF
################################################################################
## install nvm + node
################################################################################
export NVM_DIR='/usr/local/nvm'
mkdir -p "$NVM_DIR"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
2019-08-05 02:02:42 +00:00
cat > /etc/bashrc.d/100.nvm.sh <<'EOF'
source /usr/local/nvm/nvm.sh
EOF
2019-08-03 23:22:25 +00:00
source /etc/bashrc.d/100.nvm.sh
2019-08-04 08:12:18 +00:00
nvm install node
nvm use node
################################################################################
## install yarn
################################################################################
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg |
apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" |
tee /etc/apt/sources.list.d/yarn.list
apt update && apt install -y yarn
2019-08-03 23:22:25 +00:00
################################################################################
## install rbenv + ruby
################################################################################
git clone https://github.com/rbenv/rbenv.git /usr/local/rbenv
cat > /etc/bashrc.d/100.rbenv.sh <<'EOF'
export PATH="/usr/local/rbenv/bin:$PATH"
eval "$(rbenv init -)"
EOF
source /etc/bashrc.d/100.rbenv.sh
2019-08-04 08:12:18 +00:00
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
2019-08-03 23:22:25 +00:00
rbenv install $(rbenv install -l | grep -v - | tail -1)
#rbenv install 2.6.3
#rbenv install jruby-9.0.5.0
2016-04-08 11:43:57 +00:00
# install some gems
2016-04-08 12:36:49 +00:00
GEMS="
bundler
"
for GEM in $GEMS ; do
gem install -V $GEM
done
2019-08-03 23:22:25 +00:00
################################################################################
## install ppss, paralell processing shell script
################################################################################
2016-04-08 11:43:57 +00:00
cd /usr/local/bin
wget https://raw.githubusercontent.com/sneak/ppss/master/ppss
chmod +x ./ppss
2019-08-03 23:22:25 +00:00
################################################################################
## upgrade pip and install bare essentials
## update other python packages as possible
################################################################################
2019-08-04 08:12:18 +00:00
#pip3 install --upgrade pip
2019-08-03 23:22:25 +00:00
pip3 install setuptools
2019-08-04 08:12:18 +00:00
#pip3 install pip-review
#pip-review --verbose --auto
# install other python packages
2016-04-08 11:43:57 +00:00
PIP_PKGS="
awscli
2019-08-04 08:12:18 +00:00
pipenv
pylint
virtualenv
2016-04-08 11:43:57 +00:00
"
for PKG in $PIP_PKGS; do
2019-08-03 23:22:25 +00:00
pip3 install $PKG
2016-04-08 11:43:57 +00:00
done
2019-08-04 10:12:26 +00:00
2019-08-05 02:02:42 +00:00
################################################################################
## add working user and add to sudo nopassword
################################################################################
2019-08-04 10:12:26 +00:00
groupadd -g 1000 $USERNAME
useradd -u 1000 -g 1000 -s /bin/bash $USERNAME
usermod -p '*' $USERNAME
2019-08-05 02:02:42 +00:00
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers