Incorporated changes for release 1.3.0

This commit is contained in:
2026-02-24 19:59:54 -05:00
parent 3667c4358f
commit 6e5c6e03e3
38 changed files with 610 additions and 179 deletions

108
RPiSetup/ap-setup.sh Normal file
View File

@@ -0,0 +1,108 @@
#!/bin/bash
# Wireless Access Point Raspberry Pi Setup
current_user=`whoami`
if [ "$current_user" != "root" ]
then
echo "You must have root privileges to run this setup."
echo "Try 'sudo ./ap-setup.sh'"
exit 1
fi
echo ""
echo ""
echo "If this terminal connects to a network using ethernet, it can be configured"
echo "as a wireless access point for other terminals. Would you like to configure"
echo -n "this terminal as an access point? [y/N]: "
read wapconf
if [ "$wapconf" = "Y" -o "$wapconf" = "y" ]
then
echo "Configuring as wireless access point."
echo ""
echo "Copying files..."
chmod +x apsetup/usr/local/bin/*
cp apsetup/usr/local/bin/* /usr/local/bin
cp -R apsetup/etc/* /etc
echo ""
wapssidok=0
while [ "$wapssidok" -ne 1 ]
do
echo "This access point will need an SSID. This is what will appear"
echo "as the name of this terminal when other devices connect."
echo -n "Please enter the desired SSID for this access point: "
read wapssid
if [ "$wapssid" = "" ]
then
echo "SSID cannot be blank. Try again."
else
wapssidok=1
fi
done
wappassok=0
while [ "$wappassok" -ne 1 ]
do
echo "You will need to set a passphrase for this access point. It should"
echo "be at least 8 characters in length and cannot be blank."
echo -n "Please enter the desired passphrase for this access point: "
read wappass
wappasslen=`echo -n $wappass | wc -m`
if [ "$wappass" = "" -o "$wappasslen" -lt 8 ]
then
echo "Passphrase doesn't satisfy requirements above. Try again."
else
wappassok=1
fi
done
apt install hostapd
systemctl unmask hostapd
systemctl enable hostapd
echo "[NetDev]" >/etc/systemd/network/bridge-br0.netdev
echo "Name=br0" >>/etc/systemd/network/bridge-br0.netdev
echo "Kind=bridge" >>/etc/systemd/network/bridge-br0.netdev
echo "[Match]" >/etc/systemd/network/br0-member-eth0.network
echo "Name=eth0" >>/etc/systemd/network/br0-member-eth0.network
echo "" >>/etc/systemd/network/br0-member-eth0.network
echo "[Network]" >>/etc/systemd/network/br0-member-eth0.network
echo "Bridge=br0" >>/etc/systemd/network/br0-member-eth0.network
systemctl enable systemd-networkd
mv /etc/dhcpcd.conf /etc/dhcpcd.conf.old
echo "denyinterfaces wlan0 eth0" >/etc/dhcpcd.conf
cat /etc/dhcpcd.conf.old >>/etc/dhcpcd.conf
echo "interface br0" >>/etc/dhcpcd.conf
rfkill unblock wlan
echo "country_code=US" >/etc/hostapd/hostapd.conf
echo "interface=wlan0" >>/etc/hostapd/hostapd.conf
echo "bridge=br0" >>/etc/hostapd/hostapd.conf
echo "ssid=$wapssid" >>/etc/hostapd/hostapd.conf
echo "hw_mode=g" >>/etc/hostapd/hostapd.conf
echo "channel=7" >>/etc/hostapd/hostapd.conf
echo "macaddr_acl=0" >>/etc/hostapd/hostapd.conf
echo "auth_algs=1" >>/etc/hostapd/hostapd.conf
echo "ignore_broadcast_ssid=0" >>/etc/hostapd/hostapd.conf
echo "wpa=2" >>/etc/hostapd/hostapd.conf
echo "wpa_passphrase=$wappass" >>/etc/hostapd/hostapd.conf
echo "wpa_key_mgmt=WPA-PSK" >>/etc/hostapd/hostapd.conf
echo "wpa_pairwise=TKIP" >>/etc/hostapd/hostapd.conf
echo "rsn_pairwise=CCMP" >>/etc/hostapd/hostapd.conf
wget -c http://github.com/pjz/webmin-modules/releases/download/v1.0/hostap.wbm.gz
gzip -d hostap.wbm.gz
/usr/share/webmin/install-module.pl hostap.wbm
echo ""
echo ""
echo "Wireless access point setup is complete. It will be"
echo "automatically enabled after reboot. To change the SSID or"
echo "passphrase in the future, edit the file /etc/hostapd/hostapd.conf"
echo "or use the Host AP module in the Servers section of Webmin."
echo ""
echo "To disable the access point altogether in the future, run:"
echo " sudo wap-disable"
echo "at a command prompt and reboot the terminal. To re-enable it, run:"
echo " sudo wap-enable"
echo "at a command prompt and reboot the terminal."
echo "It can also be enabled or disabled via Custom Commands in the Tools"
echo "section of Webmin."
echo ""
echo -n "Press enter key to continue..."
read cont
else
exit 2
fi

View File

@@ -0,0 +1,3 @@
sudo wap-enable
Enable Wireless Access Point
pi 0 1 0 0 0 0 0 -

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
sudo wap-disable
Disable Wireless Access Point
pi 0 1 0 0 0 0 0 -

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,11 @@
/etc/hostapd/hostapd.conf
Edit Wireless Access Point Parameters
systemctl restart hostapd
0
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,8 @@
display_mode=1
params_file=0
params_cmd=0
columns=1
height=
wrap=
width=
sort=

View File

@@ -0,0 +1,4 @@
#!/bin/bash
systemctl stop hostapd
systemctl disable hostapd

View File

@@ -0,0 +1,4 @@
#!/bin/bash
systemctl enable hostapd
systemctl start hostapd

View File

@@ -0,0 +1,16 @@
#!/bin/bash
newppok=0
while [ "$newppok" -ne 1 ]
do
echo -n "New passphrase: "
read newpp
newpplen=`echo -n $newpp | wc -m`
if [ "$newpp" = "" -o "$newpplen" -lt 8 ]
then
echo "Passphrase didn't satisfy requirements. Try again or hit <ctrl>-c to abort."
else
newppok=1
fi
done
sed -i "/wpa_passphrase=.*/c wpa_passphrase=$newpp" /etc/hostapd/hostapd.conf
systemctl restart hostapd

View File

@@ -0,0 +1,15 @@
#!/bin/bash
newssidok=0
while [ "$newssidok" -ne 1 ]
do
echo -n "New SSID: "
read newssid
if [ "$newssid" = "" ]
then
echo "SSID cannot be blank. Try again or hit <ctrl>-c to abort."
else
newssidok=1
fi
done
sed -i "/ssid=.*/c ssid=$newssid" /etc/hostapd/hostapd.conf
systemctl restart hostapd

View File

@@ -1,2 +1,25 @@
# drs.conf
# URL for OpenDRS
DRS_SERVER="http://localhost"
# Set to "1" to prevent screen blanking on some monitors that go to sleep and won't wake up.
INHIBIT_BLANK="0"
# For standard DRS functionality
APP_CMD="chromium-browser --test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER"
ALIVE_STRING="chromium-browse"
KILL_CMD="killall chromium-browser"
CLEANUP_CMD="rm -rf ~/.{config,cache}/chromium/"
# Notes
# --test-type will ignore any warnings and
# --ignore-certificate-errors will allow you to kiosk any https-page without displaying certificate errors
#-----------------------------------------------------------------------
# For test use
#APP_CMD="xterm"
#ALIVE_STRING="xterm"
#KILL_CMD="killall xterm"
#CLEANUP_CMD="sleep 1"

View File

@@ -11,6 +11,13 @@ docroot_path="/var/www"
apache_user="www-data"
apache_group="www-data"
current_user=`whoami`
if [ "$current_user" != "root" ]
then
echo "You must have root privileges to run this setup."
echo "Try 'sudo ./server-setup.sh'"
exit 1
fi
echo ""
echo ""
echo ""
@@ -20,7 +27,7 @@ echo ""
echo ""
echo "You should have already run the terminal-setup.sh script in this directory."
echo ""
if [ ! -e "/etc/drs.conf" ]
if [ ! -e /etc/drs.conf ]
then
echo "It looks like the terminal-setup.sh script has not been run yet."
echo "This is required before running the server-setup.sh script."
@@ -50,23 +57,39 @@ echo ""
echo "IMPORTANT!: Be sure to make note of usernames and passwords you provide below."
echo "You will need them later."
echo ""
echo "Installing required server packages. Select apache2 as the web server to configure"
echo "automatically. Choose Yes when prompted to install phpmyadmin database and allow it to"
echo "generate a random password(leave the field blank)."
echo "Installing required server packages. You will be prompted about a couple of things:"
echo ""
echo "- Select apache2 as the web server to configure automatically."
echo ""
echo "- Choose Yes when prompted to install phpmyadmin database and allow it to"
echo " generate a random password(leave the field blank)."
echo ""
echo -n "Press enter to continue."
read continueok
echo ""
echo ""
echo ""
echo ""
apt install -y apache2 php php-mcrypt mariadb-server phpmyadmin uuid-runtime
apt install -y apache2 php mariadb-server phpmyadmin uuid-runtime
cp etc/apache2/mods-available/alias.conf /etc/apache2/mods-available
service apache2 restart
echo "...done."
echo ""
echo ""
echo "Configuring the mysql installation. Accept the defaults at the following prompts."
echo "Remember the password you set here. You'll need it during the OpenDRS install."
echo "Configuring the MariaDB installation. There will be some more prompts:"
echo ""
echo "- You'll be prompted for the current password for the root user. You've"
echo " just installed MariaDB and you haven't set one yet, so just press enter."
echo ""
echo "- You'll be prompted to switch to unix_socket authentication. Answer Y."
echo ""
echo "- You'll be prompted to change the root password. Answer Y and enter a password."
echo " Note that this is just the password for the MariaDB root user, not the terminal."
echo " DO NOT FORGET THIS PASSWORD. You'll need it later during OpenDRS install."
echo ""
echo "- Answer Y to remove anonymous users, disallow root login remotely, remove"
echo " test database and access, and reload privilege tables."
echo ""
echo -n "Press enter to proceed."
read continueok
echo ""
@@ -74,7 +97,6 @@ echo ""
echo ""
echo ""
mysql_secure_installation
mysql mysql -e "update user set plugin='';flush privileges;"
echo ""
echo ""
@@ -85,9 +107,13 @@ bad_mysql_adm=1
while [ $bad_mysql_adm -eq 1 ]
do
admintestdb="drsadm`date +%Y%m%d`"
echo "Starting OpenDRS installation."
echo ""
echo "We need to know the username and password of a MySQL administrator"
echo "to be able to create the database and user for OpenDRS. Note that this"
echo "is not necessarily the same as the login and password for the computer."
echo "to be able to create the database and user for OpenDRS. The username"
echo "will be root and the password will be the one you were urged to remember"
echo "a minute ago."
echo ""
echo -n "MySQL admin username: "
read mysql_adm_user
echo ""
@@ -100,7 +126,7 @@ do
bad_mysql_adm=0
else
echo "ERROR: Either the username/password you supplied were incorrect or the user"
echo -n "is not a MySQL administrator. Try again? [Y/N]: "
echo -n "is not a MySQL administrator. Try again? [y/N]: "
read admtry
if [ "$admtry" != "Y" -o "$admtry" != "y" ]
then
@@ -208,6 +234,10 @@ fi
echo "Installing distribution . . ."
cp -Rv ../distfiles/* $install_path
ln -s $install_path/writeups.php $install_path/index.php
if [ ! -L "$install_path/jquery-ui" ]
then
ln -s $install_path/jquery-ui* $install_path/jquery-ui
fi
echo ""
echo ""
echo ""
@@ -222,13 +252,15 @@ echo "Enter the user and group separated by a colon (username:groupname)."
echo "Enter the user:group of the OpenDRS installation"
echo -n "directory [$apache_user:$apache_group] :"
read httpd_user_group_in
if [ "$http_user_group_in" != "" ]
if [ "$httpd_user_group_in" != "" ]
then
http_user_group=$http_user_group_in
httpd_user_group="$httpd_user_group_in"
else
httpd_user_group="$apache_user:$apache_group"
fi
echo ""
echo "Setting file ownership . . ."
chown -R $httpd_user_group $install_path
chown -R $httpd_user_group $install_path
echo ""
@@ -246,7 +278,27 @@ echo "<Directory $install_path>" >> /etc/apache2/conf-available/$inst_name.conf
echo " Options FollowSymLinks" >> /etc/apache2/conf-available/$inst_name.conf
echo " DirectoryIndex index.php" >> /etc/apache2/conf-available/$inst_name.conf
echo "</Directory>" >> /etc/apache2/conf-available/$inst_name.conf
grep -q "<title>Apache2 Debian Default Page: It works</title>" /var/www/html/index.html
if [ -$? -eq 0 ]
then
echo "This apache installation appears to be new or unconfigured. Replacing the default"
echo "site index page with a more useful one."
site_hostname=`hostname`
mv /var/www/html/index.html /var/www/html/defaultindex.html
echo "<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>$site_hostname</title>
</head>
<body>
<p>
<a href=\"http://$site_hostname/$inst_name/\">$inst_name</a>
</p>
</body>
</html>" > /var/www/html/index.html
fi
a2enconf $inst_name
service apache2 reload
echo "OpenDRS server setup is complete."
@@ -265,4 +317,4 @@ echo "REMEMBER THESE CREDENTIALS. Otherwise, you will not be able to log in and"
echo "configure your new installation."
echo "It is highly recommended that you change the initial password to something"
echo "secure after logging in for the first time."
echo "DRS_SERVER=\"http://localhost/$inst_name\"" > /etc/drs.conf
sed -i 's,'DRS_SERVER=.*','DRS_SERVER="\"http://localhost/$inst_name/\""',' /etc/drs.conf

View File

@@ -6,6 +6,13 @@
# SPDX-License-Identifier: GPL-2.0
current_user=`whoami`
if [ "$current_user" != "root" ]
then
echo "You must have root privileges to run this setup."
echo "Try 'sudo ./terminal-setup.sh'"
exit 1
fi
echo ""
echo ""
echo ""
@@ -18,18 +25,21 @@ echo ""
echo "1. Created a Raspberry Pi OS Lite SD card from the latest release."
echo "2. Installed the card in a Raspberry Pi, booted it, and logged in as pi."
echo "3. Ran sudo raspi-config and :"
echo " a. Set a strong password for the pi user."
echo " b. Set hostname and, if accessing a network through wifi, the SSID and"
echo " a. Set locale, timezone, keyboard layout, and wifi country under"
echo " Localisation Options. IMPORTANT: Do this first before setting"
echo " any passwords. Changing keyboard types usually changes character"
echo " mappings, meaning your password after the change may not be what"
echo " it was before the change."
echo " b. Set a strong password for the pi user."
echo " c. Set hostname and, if accessing a network through wifi, the SSID and"
echo " passphrase under Network Options."
echo " c. Set locale, timezone, keyboard layout, and wifi country under"
echo " Localisation Options."
echo " d. Enable SSH under Interfacing Options."
echo " e. Set overscan as required to get rid of any black borders around the"
echo " edge of the display."
echo " f. Reboot when prompted and logged back in as pi."
echo "4. Transferred the OpenDRS distribution package to /home/pi on the"
echo " Raspberry Pi and extracted it."
echo "5. Changed directory to RPiSetup in the the extracted distribution directory."
echo "5. Changed directory to RPiSetup in the extracted distribution directory."
echo ""
echo "If you have completed these steps, press enter to continue. If not,"
echo -n "press ctrl-c to quit."
@@ -56,6 +66,7 @@ echo ""
echo "Copying files..."
chmod +x usr/local/bin/*
cp usr/local/bin/* /usr/local/bin
cp etc/drs.conf /etc
cp etc/apt/sources.list.d/* /etc/apt/sources.list.d
cp lib/systemd/system/getty@tty1.service /lib/systemd/system
echo ""
@@ -72,12 +83,15 @@ echo ""
echo ""
echo ""
echo ""
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
echo "deb https://download.webmin.com/download/repository sarge contrib" >/etc/apt/sources.list.d/webmin.list
wget https://download.webmin.com/jcameron-key.asc
cat jcameron-key.asc | gpg --dearmor >/etc/apt/trusted.gpg.d/jcameron-key.gpg
rm jcameron-key.asc
apt install apt-transport-https
apt update
apt install -y --no-install-recommends xorg openbox chromium-browser
apt install -y webmin cups libcups2-dev cmake
apt install -y cups libcups2-dev cmake
apt install -y webmin
addgroup lpadmin
usermod -a -G lpadmin pi
systemctl enable getty@tty1.service
@@ -101,7 +115,6 @@ echo "of your choosing."
echo -n "Press enter to continue."
read continueok
echo ""
echo ""
echo "Creating customer user..."
sleep 10
echo ""
@@ -127,11 +140,20 @@ read server_url
if [[ $server_url == "" ]]
then
conftype="Server/Terminal"
touch /etc/drs.conf
./server-setup.sh
else
conftype="Terminal"
echo "DRS_SERVER=\"$server_url\"" > /etc/drs.conf
sed -i 's,'DRS_SERVER=.*','DRS_SERVER="\"$server_url\""',' /etc/drs.conf
fi
echo ""
echo ""
./ap-setup.sh
if [ $? -ne 0 ]
then
echo "If you would like to configure this terminal as an access point at some"
echo "time in the future, log in, change directory to the"
echo "extracted distribution's RPiSetup directory, and run:"
echo " sudo ./ap-setup.sh"
fi
echo ""
echo ""
@@ -144,7 +166,21 @@ echo "yourself and any other administrators using the cloneuser command"
echo "(cloneuser pi <new username>)."
echo ""
echo ""
echo "Setup complete."
echo -n "Press enter to reboot now."
echo "Terminal setup complete."
echo ""
echo "If you would like to use this terminal as a DRS server, after rebooting"
echo "and logging back in, change directory to the extracted distribution's"
echo "RPiSetup directory, and run:"
echo " sudo ./server-setup.sh"
echo ""
echo ""
echo "A reboot is required to start using this terminal."
echo -n "Would you like to reboot now? [Y/n]: "
read rebootok
reboot
if [ "$rebootok" = "N" -o "$rebootok" = "n" ]
then
exit 0
else
reboot
fi

View File

@@ -1,32 +1,37 @@
#!/bin/bash
# startdrs.sh
source /etc/drs.conf
openbox-session &
xset s off
xset +dpms
xset dpms 0 600 1800
if [ "$INHIBIT_BLANK" -eq "1" ]
then
xset s off
xset -dpms
else
xset s off
xset +dpms
xset dpms 0 600 1800
fi
while true
do
killall chromium-browser
rm -rf ~/.{config,cache}/chromium/
# start browser to DRS Server
# --test-type will ignore any warnings and
# --ignore-certificate-errors will allow you to kiosk any https-page without displaying certificate errors
chromium-browser --test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER &
$KILL_CMD
$CLEANUP_CMD
# start application
$APP_CMD &
sleep 10
while true
do
pgrep chromium-browse
pgrep $ALIVE_STRING
if [ "$?" -eq "1" ]
then
# relaunch browser if it terminates
chromium-browser --test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER &
# relaunch application if it terminates
$APP_CMD &
fi
sleep 1
done