Merge branch 'main' of https://github.com/nprobert/pi_tools into main

This commit is contained in:
2021-09-01 15:55:46 -04:00
31 changed files with 513 additions and 2 deletions

21
CarPi/README.txt Normal file
View File

@ -0,0 +1,21 @@
Raspberry Pi 3 (RPi) Setup
==========================
After writing the MicroSD card with the Raspbian image downloaded from the raspberrypi.org site,
put it into the MicroSD card slot on the RPi and power it up.
Open a console window, and run the following commands.
sudo apt-get update
sudo install git subversion
mkdir NTCNA
cd NTCNA
svn co https://www.probestar.com/NTCNA/CVehicle (password is temppwd)
cd NTCNA/CVehicle/trunk/platforms/bboneb
./rpi-setup.sh
Takes awhile till it is done. There is a lot of software to install.
Powercycle the BBB.
Adjust start_v2v.sh link as needed, re-run to run the right apps.

4
CarPi/etc/can.conf Normal file
View File

@ -0,0 +1,4 @@
[default]
interface = socketcan_native
channel = can0

59
CarPi/etc/dhcpcd.conf Normal file
View File

@ -0,0 +1,59 @@
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# Most distributions have NTP support.
#option ntp_servers
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
# Example static IP configuration:
interface eth0
static ip_address=192.168.2.12/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.2.1
#static domain_name_servers=192.168.2.1 8.8.8.8
# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1
# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

19
CarPi/etc/hosts Normal file
View File

@ -0,0 +1,19 @@
127.0.0.1 localhost
127.0.1.1 raspberrypi pi raspberry
# vehicle network
192.168.2.1 router
192.168.2.2 wsu obe obu
192.168.2.10 mabx2
192.168.2.12 pi pi1
192.168.2.15 carpc
192.168.1.77 denso pod wsu-77
192.168.2.98 winpc
192.168.2.99 linpc
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

View File

@ -0,0 +1,2 @@
# NTCNA CVehicle library
/usr/local/cvehicle/lib

View File

@ -0,0 +1,2 @@
# other libs
/usr/local/pstar/lib

26
CarPi/etc/rc.local Normal file
View File

@ -0,0 +1,26 @@
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# CAN
ip link set can0 type can bitrate 500000 listen-only on
ifconfig can0 up
# CVehicle
/usr/local/cvehicle/sbin/cvehicle-setup
#cd /home/debian/NTCNA/CVehicle/trunk/daemons/bsmpd
#bsmpd -c can0 -m bsmpbeat.xml -t 50 -w -
# PyVehicle (DVI)
#chmod +x /home/debian/NTCNA/PyVehicle/bin/*.sh
exit 0

View File

@ -0,0 +1,15 @@
[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
# Needed with chrony SOCK refclock
After=chronyd.service
[Service]
Type=forking
EnvironmentFile=-/etc/default/gpsd
ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $DEVICES
[Install]
WantedBy=multi-user.target
Also=gpsd.socket

View File

@ -0,0 +1,11 @@
[Unit]
Description=GPS (Global Positioning System) Daemon Sockets
[Socket]
ListenStream=/var/run/gpsd.sock
ListenStream=[::1]:2947
ListenStream=0.0.0.0:2947
SocketMode=0600
[Install]
WantedBy=sockets.target

View File

@ -0,0 +1,4 @@
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@/home/pi/start_v2x.sh

View File

@ -0,0 +1,54 @@
[Session]
window_manager=openbox-lxde-pi
disable_autostart=no
polkit/command=lxpolkit
clipboard/command=lxclipboard
xsettings_manager/command=build-in
proxy_manager/command=build-in
keyring/command=ssh-agent
quit_manager/command=lxsession-logout
quit_manager/image=/usr/share/lxde/images/logout-banner.png
quit_manager/layout=top
lock_manager/command=lxlock
terminal_manager/command=lxterminal
launcher_manager/command=lxpanelctl
[GTK]
sNet/ThemeName=PiXflat
sNet/IconThemeName=PiXflat
sGtk/FontName=PibotoLt 12
iGtk/ToolbarStyle=3
iGtk/ButtonImages=0
iGtk/MenuImages=0
iGtk/CursorThemeSize=24
iXft/Antialias=1
iGtk/AutoMnemonics=1
iGtk/EnableMnemonics=1
sGtk/ColorScheme=selected_bg_color:#878791919b9b\nselected_fg_color:#f0f0f0f0f0f0\nbar_bg_color:#ededececebeb\nbar_fg_color:#000000000000\n
sGtk/CursorThemeName=PiXflat
iGtk/ToolbarIconSize=3
sGtk/IconSizes=gtk-large-toolbar=24,24
iNet/EnableEventSounds=1
iNet/EnableInputFeedbackSounds=1
iXft/Hinting=1
sXft/HintStyle=hintfull
sXft/RGBA=rgb
[Mouse]
AccFactor=20
AccThreshold=10
LeftHanded=0
[Keyboard]
Delay=500
Interval=30
Beep=1
[State]
guess_default=true
[Dbus]
lxde=true
[Environment]
menu_prefix=lxde-pi-

View File

@ -0,0 +1,9 @@
#!/bin/bash
export TEXTDOMAIN=pprompt
. gettext.sh
if [ -e /run/sshwarn ] ; then
zenity --warning --width=400 --text="$(gettext "SSH is enabled and the default password for the 'pi' user has not been changed.\n\nThis is a security risk - please login as the 'pi' user and run Raspberry Pi Configuration to set a new password.")"
fi

View File

@ -0,0 +1 @@
<EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><EFBFBD>ѩ

View File

@ -0,0 +1,21 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/vnc.passwd -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target

100
CarPi/rpi-setup.sh Executable file
View File

@ -0,0 +1,100 @@
#!/bin/sh
# copy config files
for i in etc lib usr
do
sudo cp -r $i/* /$i/
done
cp -r home/pi/.* /home/pi/
# network
echo "Networking installed, use WiFi for Internet"
# update & clean
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install -y ntpdate subversion git cmake
sudo apt-get -y autoremove
sudo apt-get clean
# Need rc.local to start CAN and BSMPd
sudo systemctl enable rc-local.service
if [ ! -f /etc/init/x11vnc.conf ]; then
sudo systemctl enable x11vnc.service
fi
# time
sudo ntpdate pool.ntp.org
sudo hwclock -w
sudo apt-get update
# clone/pull
mkdir -p $HOME/ProbeStar
cd $HOME/ProbeStar
for i in git_tools linux_tools pi_tools Cnomicon Pynomicon
do
if [ -d $i ]; then
cd $i
git config credential.helper store
git pull --recurse-submodules
cd ..
else
git clone https://github.com/nprobert/$i --recurse-submodules
fi
done
cd $HOME
for i in ProbeStar/*; do
ln -fs $i
done
mkdir bin
cp linux_tools/bin/* bin/
# checkouts
mkdir -p $HOME/NTCNA
cd $HOME/NTCNA
for i in CVehicle PyVehicle
do
if [ -d $i ]; then
cd $i
git config credential.helper store
git pull --recurse-submodules
cd ..
else
git clone https://github.com/nprobert/$i --recurse-submodules
fi
done
cd $HOME
for i in NTCNA/*; do
ln -fs $i
done
# packages & builds
if [ -d $HOME/ProbeStar/Cnomicon ]; then
cd $HOME/Cnomicon/packages
./packages.sh
cd ..
./cbuild.sh
./cinstall.sh
fi
if [ -d $HOME/NTCNA/CVehicle ]; then
cd $HOME/CVehicle/packages
./packages.sh
cd ..
./cbuild.sh
./cinstall.sh
fi
# python stuff
cd $HOME/NTCNA/Pynomicon/packages
./packages.sh
chmod +x $HOME/Pynomicon/bin/*.sh
cd $HOME/NTCNA/PyVehicle/packages
./packages.sh
chmod +x $HOME/PyVehicle/bin/*.sh
# cleanup
sudo raspi-config
git config --global user.email "nprobert@probestar.net"
git config --global user.name "Neal Probert"

16
CarPi/rpi-update.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# copy config files
sudo cp -r etc lib usr /
# Need rc.local?
sudo systemctl enable rc-local.service
# update
sudo ntpdate pool.ntp.org
sudo hwclock -w
# checkouts
pstar-update.sh
ntcna-update.sh

View File

@ -0,0 +1,19 @@
#!/bin/bash
cd $HOME
for i in ProbeStar NTCNA CAMP Gits
do
if [ -L "$i" ]; then
echo "$i: Symlinked"
echo "============="
elif [ -d "$i" ]; then
if [ "$i" == "ProbeStar" ]; then
$HOME/bin/pstar-update.sh
else
d=`echo "${i,,}"`
$HOME/bin/$d-update.sh
fi
fi
done

View File

@ -0,0 +1,58 @@
#!/bin/bash
function do_git {
echo $1 "(Git)"
cd $1
git ls-remote --get-url
git pull
cd ..
echo
}
function do_merc {
echo $1 "(Mercurial)"
cd $1
hg pull -uv
cd ..
echo
}
function do_svn {
echo $1 "(Subversion)"
cd $1
svn info --show-item url
svn update
cd ..
echo
}
function do_dir {
pwd
echo $1
echo "-----------------"
for i in *
do
if [ -d $i ]; then
if [ -d $i/.git ]; then
do_git $i
elif [ -d $i/.hg ]; then
do_merc $i
elif [ -d $i/.svn ]; then
do_svn $i
else
cd $i
do_dir $i
cd ..
fi
fi
done
}
if [ -d $HOME/NTCNA ]; then
cd $HOME/NTCNA
echo "NTCNA Repositories"
echo "=================="
do_dir .
echo "=================="
fi

View File

@ -0,0 +1,57 @@
#!/bin/bash
function do_git {
echo $1 "(Git)"
cd $1
git ls-remote --get-url
git pull
cd ..
echo
}
function do_merc {
echo $1 "(Mercurial)"
cd $1
hg pull -u
cd ..
echo
}
function do_svn {
echo $1 "(Subversion)"
cd $1
svn info --show-item url
svn update
cd ..
echo
}
function do_dir {
pwd
echo $1
echo "-----------------"
for i in *
do
if [ -d $i ]; then
if [ -d $i/.git ]; then
do_git $i
elif [ -d $i/.hg ]; then
do_merc $i
elif [ -d $i/.svn ]; then
do_svn $i
else
cd $i
do_dir $i
cd ..
fi
fi
done
}
if [ -d $HOME/ProbeStar ]; then
cd $HOME/ProbeStar
echo "P* Repositories:"
echo "================"
do_dir .
echo "================"
fi

View File

@ -0,0 +1,3 @@
#!/bin/bash
x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -rfbauth /etc/x11vnc.pass -auth /etc/x11vnc.pass -forever

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,4 @@
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@/home/pi/start_v2x.sh
@/home/pi/start_rpi.sh