#!/bin/bash PANDORA=${PANDORA-pandora} echo Installing pandora with user: $PANDORA getent passwd $PANDORA > /dev/null 2>&1 || adduser --disabled-password --gecos "" $PANDORA LXC=`grep -q lxc /proc/1/environ && echo 'yes' || echo 'no'` if [ -e /etc/os-release ]; then . /etc/os-release else ID=unknown fi UBUNTU_VERSION="$VERSION_ID" if [ -d "/run/systemd/system/" ]; then SYSTEMD="yes" else SYSTEMD="no" fi export DEBIAN_FRONTEND=noninteractive echo "deb http://ppa.launchpad.net/j/pandora/ubuntu trusty main" > /etc/apt/sources.list.d/j-pandora.list apt-key add - < /etc/apt/apt.conf.d/99languages apt-get update -qq if [ "$LXC" == "no" ]; then apt-get install -y \ acpid \ ntp fi apt-get install -y \ sudo \ openssh-server \ vim \ wget \ pwgen \ nginx \ rabbitmq-server \ git \ python-setuptools \ python-pip \ python-virtualenv \ python-imaging \ python-dev \ python-imaging \ python-numpy \ python-psycopg2 \ python-pyinotify \ python-simplejson \ python-lxml \ python-html5lib \ python-ox \ oxframe \ ffmpeg \ mkvtoolnix \ gpac \ imagemagick \ poppler-utils \ ipython \ postfix \ postgresql \ postgresql-contrib sudo -u postgres createuser -S -D -R $PANDORA sudo -u postgres createdb -T template0 --locale=C --encoding=UTF8 -O $PANDORA pandora echo "CREATE EXTENSION pg_trgm;" | sudo -u postgres psql pandora #rabbitmq RABBITPWD=$(pwgen -n 16 -1) rabbitmqctl add_user pandora $RABBITPWD rabbitmqctl add_vhost /pandora rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*" #pandora git clone https://git.0x2620.org/pandora.git /srv/pandora cd /srv/pandora ./ctl init HOST=$(hostname -s) HOST_CONFIG="/srv/pandora/pandora/config.$HOST.jsonc" SITE_CONFIG="/srv/pandora/pandora/config.jsonc" test -e $HOST_CONFIG && cp $HOST_CONFIG $SITE_CONFIG test -e $SITE_CONFIG || cp /srv/pandora/pandora/config.pandora.jsonc $SITE_CONFIG cat > /srv/pandora/pandora/local_settings.py <> /srv/pandora/pandora/local_settings.py fi /srv/pandora/ctl start #logrotate cp "/srv/pandora/etc/logrotate.d/pandora" "/etc/logrotate.d/pandora" #nginx cp "/srv/pandora/etc/nginx/pandora" "/etc/nginx/sites-available/default" read -r -d '' GZIP <> /etc/systemd/timesyncd.conf else cat > /etc/cron.d/ntp_fixtime </dev/null EOF fi cat > /usr/local/bin/genissue < /etc/issue cat > /etc/rc.local < /etc/issue EOF chmod +x /etc/rc.local fi apt-get clean cat > /home/$PANDORA/.vimrc < "+gP imap i vmap "+y filetype plugin indent on syntax on au BufNewFile,BufRead *.jsonc setf javascript nmap :tabprev nmap :tabnext hi SpellBad ctermbg=0 nnoremap :set invpaste paste? set pastetoggle= set showmode set lcs=tab:→·,trail:·,nbsp:˽ set list EOF