Initial changes to support FreeBSD.

This commit is contained in:
Retro_Guy 2024-12-01 16:04:41 -07:00
parent 67235324cf
commit 5c69415fb1
6 changed files with 372 additions and 16 deletions

View File

@ -22,18 +22,48 @@ php is required, and your web server must be configured to serve .php.
php 8.2 or greater is required. Development and testing on Debian.
php-mbstring (to support other character sets)
sharutils (for uudecode)
openssl
php-gnupg
php8.x-sqlite3 (or later version).
phpmailer is required if email confirmation is to be used.
php-xml to work with RSS feeds
compface, php-gd and libgd3 for X-Face support
memcached, php-memcached for memcached support
Debian Requirements:
* php-mbstring (to support other character sets)
* sharutils (for uudecode)
* openssl
* php-gnupg
* php8.x-sqlite3 (or later version).
* phpmailer is required if email confirmation is to be used.
* php-xml (for RSS feed support)
* compface (for x-face display support)
* php-gd (for x-face display support)
* libgd3 (for x-face display support)
* memcached (for memory caching)
* php-memcached (for memory caching)
* fortunes (to display fortunes)
* fortunes-mod (some fortunes)
* fortunes-min (some more fortunes)
These are the names for Debian packages. Other distributions should
also provide these in some way.
FreeBSD Requirements:
* sharutils
* openssl
* pecl-gnupg
* php8x-pcntl
* php8x-pdo_sqlite
* php8x-session
* php8x-posix
* php8x-filter
* php8x-gd
* php8x-sqlite3
* php8x-mbstring
* php8x-iconv
* php8x-xml (for RSS feed support)
* phpmailer (for email)
* faces (for x-face display support)
* memcached (for memory caching)
* pecl-memcached (for memory caching)
* fortune-mod (some fortunes to get you started)
you may wish to manually remove any fortunes in
/usr/local/share/games/fortune you do not wish to display:
ex: limerick and *-o*
If you wish to display UNIX fortunes in the header, install:
fortunes, fortune-mod and fortunes-min

View File

@ -25,13 +25,11 @@ synchronized with other rslight installs, or other nntp servers.
* Tested with Claws Mail, Thunderbird, Knews, tin, Pan and some others
* NoCeM and Spamassassin support
* Message expiration by site or by group
* Send/Receive mail to/from users at other Rocksolid Light sites
* Search article bodies
* Display body snippet in overboard and search results
* Email authentication if enabled
* Protect poster email addresses if enabled
* Interface works reasonably well on small devices
* Colors in CSS are in a separate file for easy testing and modification
* Groups can be renamed for cleaner display

View File

@ -0,0 +1,136 @@
#!/usr/local/bin/bash
webroot="/usr/local/www/html"
spoolpath="/var/spool/rslight"
configpath="/usr/local/etc/rslight"
username="www"
randpw(){ < /dev/urandom tr -dc _A-Z-a-z-0-9{} | head -c${1:-16};echo;}
site_key=$(openssl rand -base64 12)
anonymous_password=$(openssl rand -base64 12)
local_password=$(openssl rand -base64 12)
admin_password=$(openssl rand -base64 12)
admin_key=$(openssl rand -base64 12)
echo
echo "This is the main installation script for Rocksolid Light"
echo "and must be run as root from the root directory of the extracted files"
echo
echo "Select installation directories"
echo
echo "Choose a path for your web root for rslight"
read -p "Use default web root $webroot (y/n)? " default; echo
if [ "${default^^}" != "Y" ]
then
read -p "Enter web root for rslight: " webroot; echo
fi
echo "Choose a path for your spool files for rslight"
read -p "Use default spool path $spoolpath (y/n)? " default; echo
if [ "${default^^}" != "Y" ]
then
read -p "Enter spool path for rslight: " spoolpath; echo
fi
echo "Choose a path for rslight configuration files"
read -p "Use default config path $configpath (y/n)? " default; echo
if [ "${default^^}" != "Y" ]
then
read -p "Enter config path for rslight: " configpath; echo
fi
echo "Choose username used by your web server"
read -p "Use default username $username (y/n)? " default; echo
if [ "${default^^}" != "Y" ]
then
read -p "Enter username used by your web server: " username; echo
fi
echo
echo "You have selected the following options:"
echo
echo "Web root: $webroot"
echo "Spool dir: $spoolpath"
echo "Config dir: $configpath"
echo "Web user: $username"
echo
echo "Are you sure you wish to install to these directories now"
echo "and change permissions as necessary to $username? "
echo
read -p "Type 'YES' to create the directories and move files into place: " default; echo
if [ "$default" != "YES" ]
then
echo exiting...
exit
fi
echo "Creating directories"
echo -n "$webroot..."
mkdir -p $webroot
echo "done"
echo -n "$spoolpath..."
mkdir -p $spoolpath
echo "done"
echo -n "$configpath..."
mkdir -p $configpath
mkdir -p $configpath/rss
mkdir -p $configpath/users
mkdir -p $configpath/userconfig
echo "done"
echo
echo -n "Moving files into place..."
cp index.php $webroot
cp -a common $webroot
cp -a rocksolid $webroot
cp -a spoolnews $webroot
cp -a rslight/* $configpath
cp rslight/fortunes.conf.bsd $configpath/fortunes.conf
echo "done"
echo
echo -n "Setting permissions..."
chown $username $spoolpath
chgrp $username $spoolpath
chown $username "$configpath/users"
chgrp $username "$configpath/users"
chmod 700 "$configpath/users"
chown $username "$configpath/userconfig"
chgrp $username "$configpath/userconfig"
chmod 700 "$configpath/userconfig"
chown $username "$configpath/rslight.inc.php"
chgrp $username "$configpath/rslight.inc.php"
echo "done"
echo
echo -n "Applying configuration..."
sed -i -e "s|<spooldir>|$spoolpath/|" $webroot/common/config.inc.php
sed -i -e "s|<config_dir>|$configpath/|" $webroot/common/config.inc.php
sed -i -e "s|<webserver_user>|$username|" $configpath/rslight.inc.php
sed -i -e "s|<site_key>|$site_key|" $configpath/rslight.inc.php
sed -i -e "s|<anonymous_password>|$anonymous_password|" $configpath/rslight.inc.php
sed -i -e "s|<local_password>|$local_password|" $configpath/rslight.inc.php
sed -i -e "s|<admin_password>|$admin_password|" $configpath/admin.inc.php
sed -i -e "s|<admin_key>|$admin_key|" $configpath/admin.inc.php
sed -i -e "s|<sessions_path>|/var/lib/php/sessions|" $configpath/rslight.inc.php
echo "done"
echo
echo "***************************************************"
echo "******** YOUR ADMIN PASSWORD IS: '$admin_password'"
echo "***************************************************"
echo
echo "Admin password can be changed in $configpath/admin.inc.php"
echo
echo "Next step is to visit your site in your browser: /common/setup.php"
echo "to complete configuration"
echo
echo Add this to crontab for root to link with your remote server, start local
echo server and manage other tasks:
echo "*/5 * * * * cd $webroot/spoolnews ; bash -lc \"php $configpath/scripts/cron.php\""
echo
echo "Once your web server is configured to point to $webroot and serve .php files"
echo "give it a try. If you have trouble, feel free to ask for help in rocksolid.nodes.help"
echo
echo "Note that it may take 10-20 minutes before groups appear on your main page"
echo "If you see files starting to appear in $spoolpath, it should be working"
echo
echo "Installation complete"

View File

@ -0,0 +1,128 @@
#!/usr/local/bin/bash
webroot="/usr/local/www/html"
spoolpath="/var/spool/rslight"
configpath="/usr/local/etc/rslight"
username="www"
echo
echo "This is an UPGRADE script for Rocksolid Light"
echo "and must be run as root from the root directory of the extracted files"
echo
echo "Are you sure you wish to UPGRADE your installation?"
echo "This action will overwrite your currently installed scripts"
echo
read -p "Type 'YES' to write the directories and overwrite current scripts: " default; echo
if [ "$default" != "YES" ]
then
echo exiting...
exit
fi
echo
echo "Select current installation directories"
echo
echo "Choose a path for your web root for rslight"
read -p "Use default web root $webroot (y/n)? " default; echo
if [ "${default^^}" != "Y" ]
then
read -p "Enter web root for rslight: " webroot; echo
fi
echo "Choose a path for your spool files for rslight"
read -p "Use default spool path $spoolpath (y/n)? " default; echo
if [ "${default^^}" != "Y" ]
then
read -p "Enter spool path for rslight: " spoolpath; echo
fi
echo "Choose a path for rslight configuration files"
read -p "Use default config path $configpath (y/n)? " default; echo
if [ "${default^^}" != "Y" ]
then
read -p "Enter config path for rslight: " configpath; echo
fi
echo "Choose username used by your web server"
read -p "Use default username $username (y/n)? " default; echo
if [ "${default^^}" != "Y" ]
then
read -p "Enter username used by your web server: " username; echo
fi
echo
echo "You have selected the following options:"
echo
echo "Web root: $webroot"
echo "Spool dir: $spoolpath"
echo "Config dir: $configpath"
echo "Web user: $username"
echo
echo "Are you sure you wish to UPGRADE to these directories now,"
echo "overwrite files and change permissions as necessary to $username? "
echo
read -p "Type 'YES' to write the directories and overwrite current scripts: " default; echo
if [ "$default" != "YES" ]
then
echo exiting...
exit
fi
echo "Creating directories"
echo -n "$webroot..."
mkdir -p $webroot
echo "done"
echo -n "$spoolpath..."
mkdir -p $spoolpath
echo "done"
echo -n "$configpath..."
mkdir -p $configpath
echo "done"
echo
echo -n "Moving files into place..."
cp index.php $webroot
cp -a common $webroot
cp -a rocksolid $webroot
cp -a spoolnews $webroot
cp rslight/scripts/* $configpath/scripts
mkdir $configpath/upgrade
cp rslight/*.php $configpath/upgrade
cp rslight/*.conf $configpath/upgrade
cp rslight/*.dist $configpath/upgrade
cp rslight/fortunes.conf.bsd $configpath/upgrade/fortunes.conf
echo "done"
echo
echo -n "Setting permissions..."
chown $username $spoolpath
chgrp $username $spoolpath
chown $username "$configpath/users"
chgrp $username "$configpath/users"
chmod 700 "$configpath/users"
chown $username "$configpath/userconfig"
chgrp $username "$configpath/userconfig"
chmod 700 "$configpath/userconfig"
chown $username "$configpath/rslight.inc.php"
chgrp $username "$configpath/rslight.inc.php"
echo "done"
echo
echo -n "Setting semaphore to restart nntp server(s)..."
touch "$configpath/nntp.reload"
chown $username "$configpath/nntp.reload"
chgrp $username "$configpath/nntp.reload"
echo "done"
echo
echo -n "Applying configuration..."
sed -i -e "s|<spooldir>|$spoolpath/|" $webroot/common/config.inc.php
sed -i -e "s|<config_dir>|$configpath/|" $webroot/common/config.inc.php
sed -i -e "s|<webserver_user>|$username|" $configpath/upgrade/rslight.inc.php
echo "done"
echo
echo "All new configuration files have been placed in $configpath/upgrade."
echo "If you choose to use these files, you may need to copy passwords and keys"
echo "from your original files in $configpath."
echo
echo "Please review these files and make changes to existing files as may be necessary"
echo
echo "Upgrade complete"

View File

@ -5,6 +5,10 @@
*/
$enable_fortunes = true;
// Uncomment (remove '//' for only one selection below)
$fortune_command = '/usr/games/fortune -s -n 100'; // Debian
// $fortune_command = '/usr/bin/fortune -s'; // BSD
/* Creating a file: $config_dir.'/motd.txt' will override fortunes and display the file contents. */
if($enable_fortunes == true) {
@ -15,16 +19,29 @@ if($enable_fortunes == true) {
}
if($config_name == 'computers' || $config_name == 'programming') {
passthru('/usr/games/fortune -s -n 100 linux science debian perl linuxcookie cookie computers startrek math.fortunes');
passthru($fortune_command . ' linux science debian perl linuxcookie cookie computers startrek math.fortunes');
} else if ($config_name == 'arts' || $config_name == 'interests') {
passthru('/usr/games/fortune -s -n 100 fortunes education people platitudes art magic wisdom tao cookie songs-poems work food miscellaneous literature pets science wisdom');
passthru($fortune_command . ' fortunes education people platitudes art magic wisdom tao cookie songs-poems work food miscellaneous literature pets science wisdom');
} else if ($config_name =='sport') {
passthru('/usr/games/fortune -s -n 100 sports');
passthru($fortune_command . ' sports');
} else {
passthru('/usr/games/fortune -s -n 100');
passthru($fortune_command);
}
$motd = ob_get_contents();
$motd = htmlentities($motd);
ob_end_clean();
$nicole = date('i');
$ellen = rand(1,59);
if($nicole == $ellen - 1) {
$motd = "<center>*** YOU'RE A WINNER!!! Your next 30 days of service for half price! ***</center>";
}
if(isset($_COOKIE['mail_name'])) {
if($nicole == $ellen) {
$motd = '"' . $_COOKIE['mail_name'] . ' was here" -- ' . $_COOKIE['mail_name'];
}
}
}

View File

@ -0,0 +1,47 @@
<?php
/* This file is an example. Modify to match your system
* The fortunes package must be installed for this to work
* $enable_fortunes will enable or disable display of 'fortunes' in the header
*/
$enable_fortunes = true;
// Uncomment (remove '//' for only one selection below)
//$fortune_command = '/usr/games/fortune -s -n 100'; // Debian
$fortune_command = '/usr/bin/fortune -s'; // BSD
/* Creating a file: $config_dir.'/motd.txt' will override fortunes and display the file contents. */
if($enable_fortunes == true) {
ob_start();
if(!isset($config_name)) {
$config_name = null;
}
if($config_name == 'computers' || $config_name == 'programming') {
passthru($fortune_command . ' linux science debian perl linuxcookie cookie computers startrek math.fortunes');
} else if ($config_name == 'arts' || $config_name == 'interests') {
passthru($fortune_command . ' fortunes education people platitudes art magic wisdom tao cookie songs-poems work food miscellaneous literature pets science wisdom');
} else if ($config_name =='sport') {
passthru($fortune_command . ' sports');
} else {
passthru($fortune_command);
}
$motd = ob_get_contents();
$motd = htmlentities($motd);
ob_end_clean();
$nicole = date('i');
$ellen = rand(1,59);
if($nicole == $ellen - 1) {
$motd = "<center>*** YOU'RE A WINNER!!! Your next 30 days of service for half price! ***</center>";
}
if(isset($_COOKIE['mail_name'])) {
if($nicole == $ellen) {
$motd = '"' . $_COOKIE['mail_name'] . ' was here" -- ' . $_COOKIE['mail_name'];
}
}
}