Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 130 lines (106 sloc) 2.17 KB
#!/usr/bin/bash
# USBPI install script
# initial run on bare system
#
# pacman -Sy git # update pacman-data and install git
# git clone https://github.molgen.mpg.de/wwwutz/usbpi.git
GHM="https://github.molgen.mpg.de/wwwutz/usbpi.git"
GITS=( ${GHM} ${GHM} )
IAM=PIPLUS
SSHKEY=/dev/shm/sshkey
RASPIMAC=( b8:27:eb:a5:6d:80 b8:27:eb:d6:da:bd )
RASPDESC=( "USB IP Node" "USB IP Node" )
HOSTNAME=( piplus pipiplus )
MYMAC=`cat /sys/class/net/eth0/address`
RASPIDX=0
for mac in ${RASPIMAC[@]}; do
if [ ${MYMAC} != ${mac} ]; then
RASPIDX=$(( ${RASPIDX} + 1 ))
fi
done
echo "I'm a ${RASPDESC[${RASPIDX}]}"
LOC=${RASPIDX}
if [ ! -e ${SSHKEY} ]; then
cat>>${SSHKEY}<<'__EOK__'
-----BEGIN DSA PRIVATE KEY-----
-----END DSA PRIVATE KEY-----
__EOK__
chmod 600 ${SSHKEY}
fi
# yeeha
cat >${IAM}.sh.func<<"__EOF__"
LOC=${LOC}
GIT=${GITS[${LOC}]}
function GETFILES {
git pull
}
__EOF__
. ./${IAM}.sh.func
# files immer updaten, nur bei u exiten
GETFILES
if [ $1'x' == 'ux' ]; then
exit
fi
# hostnamen setzen
hostnamectl set-hostname ${HOSTNAME[${LOC}]}
if [ ${LOC} == 0 ]; then
# tastatur
localectl set-keymap de-latin1
fi
# zeitzone
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
#
# set up access keys
#
AUTHKEY=/root/.ssh/authorized_keys
if [ -e ${AUTHKEY} ]; then
grep -vq 'ssh-dss AAAAB3NzaC1kc3MAAACBAIgBYWpHOQ' ${AUTHKEY}
if [ $? != 1 ]; then
cat afk_id_dsa.pub >> ${AUTHKEY}
chmod 600 ${AUTHKEY}
fi
fi
function EXIT {
echo "bad exit. $1"
exit 1
}
function PATCH() {
local FO=$1
shift
local FI=.${IAM}/${FO/*\//}
if [ ! -e ${FI} ]; then
cp -v ${FO} ${FI}
if [ $? != 0 ]; then
echo "$!"
exit $?
fi
fi
"${@}" ${FI} > ${FO}
}
function install_PKG {
local PKG=$1
pacman -Q ${PKG}
if [ $? == 1 ]; then
pacman --noconfirm -S ${PKG}
if [ $? != 0 ]; then
EXIT "pacman -S ${PKG} failed $?"
fi
fi
}
function remove_PKG {
local PKG=$1
pacman -Q ${PKG}
if [ $? == 0 ]; then
pacman -R ${PKG}
if [ $? != 0 ]; then
EXIT "pacman -R ${PKG} failed $?"
fi
fi
}
pacman -Sy
install_PKG ntp
cp ntp.conf /etc
systemctl enable ntpdate.service
systemctl start ntpdate.service
install_PKG wget
install_PKG usbip