Addes remaining Files

This commit is contained in:
2021-03-28 21:04:16 +02:00
parent 53ad7f7a9c
commit 3af1e4dab6
5 changed files with 272 additions and 0 deletions

118
base_install.sh Executable file
View File

@@ -0,0 +1,118 @@
#!/bin/sh
#
# Prepare Base System
# run as Sudo
#
#Update Base system
apt-get update && apt-get upgrade -y
#Remove unused software
dpkg --purge logi-rts
#Install editor and git system
apt install vim git -y
#Install python3 packages
apt-get install python3-requests python3-wrapt -y
apt-get install python-virtualenv python3-virtualenv virtualenv -y
#Install python can Interface
pip3 install python-can
pip3 install pytz
#Install Sqlite3 Database
apt-get install sqlite3 -y
apt-get install mysql-common -y
#defaults
update-alternatives --set editor /usr/bin/vim.basic
#alternative Apt Repos
apt-get install apt-transport-https ca-certificates software-properties-common -y
#Add ssh Info to pi user
# FixMe remove user and add service user
mkdir /home/pi/.ssh
cp files/id_rsa.pi /home/pi/.ssh/id_rsa
cp files/authorized_keys.pi /home/pi/.ssh/authorized_keys
chown -R pi:pi /home/pi/.ssh
chmod 755 /home/pi/.ssh/
chmod 644 /home/pi/.ssh/authorized_keys
chmod 600 /home/pi/.ssh/id_rsa
#Add Users
#Michi
useradd -m -p saEEcrZBB7ynE -G adm,sudo michi
mkdir /home/michi/.ssh
cp files/authorized_keys.michi /home/michi/.ssh/authorized_keys
chown -R michi:michi /home/michi/.ssh
chmod 755 /home/michi/.ssh/
chmod 644 /home/michi/.ssh/authorized_keys
cp files/.gitconfig.michi /home/michi/.gitconfig
chown michi:michi /home/michi/.gitconfig
cp files/.vimrc.michi /home/michi/.vimrc
chown michi:michi /home/michi/.vimrc
#herde Passwort herde
useradd -m -p saJNWiRbbeNac herde
#zope
adduser --system zope
usermod -a -G adm zope
#Fix Rights
chgrp adm /opt
chmod g+w /opt
#Create directories
mkdir /srv/herde
chown root:herde -R /srv/herde
chmod 777 /srv/herde
mkdir /var/log/lactor
chmod 775 /var/log/lactor
mkdir /opt/data
chown root:adm /opt/data
chmod 775 /opt/data
#Clone Repos
git clone gitosis@git.rosstein.de:sf_adis /opt/adis
git clone gitosis@git.rosstein.de:sf_lactor /opt/lactor
#Copy
chown -R zope:adm /opt/adis
chmod 774 /opt/adis
chmod -R g+w /opt/adis
#Create local config
#FixMe Branch
cp /opt/lactor/lactor.cfg.tpl /opt/lactor/lactor.cfg
cp /opt/lactor/spider.cfg.tpl /opt/lactor/spider.cfg
chgrp -R adm /opt/lactor
chmod g+w -R /opt/lactor
#Autostart
ln -s /opt/lactor/lactor.init /etc/init.d/lactor
ln -s /etc/init.d/lactor /etc/rc2.d/S10lactor
#Logrotate
ln -s /opt/lactor/logrotate.cnf /etc/logrotate.d/lactor
rm /etc/logrotate.d/btmp
rm /etc/logrotate.d/wtmp
#Create initial DB
#obacht Branch !!!
sqlite3 /opt/data/animaldb-clean.sqlite < /opt/lactor/initdata/dblayout.sql
chown root:adm /opt/data/animaldb-clean.sqlite
chmod 774 /opt/data/animaldb-clean.sqlite
ln -s /opt/data/animaldb-clean.sqlite /opt/data/animaldb.sqlite
#Cleanup
apt-get clean
#Samba
apt-get install samba -y
smbpasswd -a herde
cp files/smb.conf /etc/samba
#Check systemctl enable smbd

25
docker.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
#Install Dockersystem
#Prepare System to use Netfilter instead of nftables
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
touch /etc/apt/sources.list.d/docker.list
echo 'deb [arch=armhf] https://download.docker.com/linux/debian/ buster stable' > /etc/apt/sources.list.d/docker.list
apt update
apt install --no-install-recommends docker-ce docker-compose -y
systemctl enable docker
#prevent SYN Flood errors
echo "net.core.somaxconn = 2048" >> /etc/sysctl.conf
#RestAPI - Container
git clone gitosis@git.rosstein.de:sf_lactorapi.git /opt/lactorapi
chgrp -R adm /opt/lactorapi
chmod g+w -R /opt/lactorapi
#docker-compose run web python manage.py makemigrations
#docker-compose run web python manage.py migrate
#docker-compose up -d

3
files/.gitconfig.michi Normal file
View File

@@ -0,0 +1,3 @@
[user]
name = Michael Rest
email = mr@mir.systems

87
files/.vimrc.michi Normal file
View File

@@ -0,0 +1,87 @@
" Copied from $VIMRUNTIME/vimrc_example.vim
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2002 Sep 19
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
set sw=2
set tabstop=8
set et

39
zope.sh Normal file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
cd /opt/
virtualenv --no-site-packages zope-env
cd zope-env
source bin/activate
bin/easy_install -i http://download.zope.org/Zope2/index/2.13.24 Zope2
bin/easy_install ExtensionClass==2.13.2
bin/easy_install Record==2.13.0
bin/easy_install AccessControl==2.13.14
bin/easy_install Products.ZMySQLDA==3.1.1
bin/easy_install Products.ZSQLMethods==2.13.4
#Fixme Version 0.7 for Py 3 ?
bin/pip install Products.ZSQLiteDA==0.6.1
bin/pip uninstall RestrictedPython
bin/easy_install RestrictedPython==3.6.0
bin/pip install ThreadLock
bin/pip install Six
bin/mkzopeinstance -d /opt/Zope_lactor -u admin:sofia-fitting-chisel-shaky
mkdir /opt/Zope_lactor/Extensions
mkdir /opt/Zope_lactor/var/sqlite
cd /opt/Zope_lactor/var/sqlite
ln -s /opt/data/animaldb.sqlite ./
#Add ADIS_LKV.py and timerange.py to /opt/zope/Extensions
cp /opt/adis/ADIS_LKV.py /opt/Zope_lactor/Extensions/ADIS_LKV.py
cp /opt/adis/timerange.py /opt/Zope_lactor/Extensions/timerange.py
cp /opt/adis/siliconform.zexp /opt/Zope_lactor/import
#Startskripte
ln -s /opt/Zope_lactor/bin/zopectl /etc/init.d/zopectl
ln -s /etc/init.d/zopectl /etc/rc2.d/S10zopectl
sudo chown -R zope:adm zope-env /opt/Zope_lactor
#Workaround
sed -i 's/# zserver-threads 10/zserver-threads 1/g' /opt/Zope_lactor/etc/zope.conf
sed -i 's/# effective-user chrism/effective-user zope/g' /opt/Zope_lactor/etc/zope.conf
sed -i 's/ address 8080/ address 80/g' /opt/Zope_lactor/etc/zope.conf