Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 16d1ff9bb8 |
41
CHANGELOG
@@ -27,17 +27,38 @@ Changelog
|
||||
back button in terminal mode.
|
||||
- Added configurable help text for period effective selection.
|
||||
- Changed Sim period effective from selection to yes/no radio buttons.
|
||||
- Writeup groups page shows collapsed list of groups. Click the expand icon
|
||||
to expand each group.
|
||||
- Fixed bug where entries made on stale create page had inaccurate date/time.
|
||||
- For logged in users, added the ability to select writeups directly on the
|
||||
View All Writeups page and assign/create a group.
|
||||
- On the Create New Writeup page, removed the default selections for Device,
|
||||
Subsystem, and Period dropdowns, forcing user to make a selection.
|
||||
- Writeup groups page shows collapsed list of groups. Click the expand
|
||||
icon to expand each group.
|
||||
- Fixed bug where entries made on stale create page had inaccurate
|
||||
date/time.
|
||||
- For logged in users, added the ability to select writeups directly on
|
||||
the View All Writeups page and assign/create a group.
|
||||
- On the Create New Writeup page, removed the default selections for
|
||||
Device, Subsystem, and Period dropdowns, forcing user to make a
|
||||
selection.
|
||||
- Added a Today button to the View All Writeups page
|
||||
- Changed the Period dropdowns on the Create, Search, and Group pages to show
|
||||
the times instead of the period numbers. Period numbers are still shown
|
||||
in the results tables with mouse hover showing times.
|
||||
- Changed the Period dropdowns on the Create, Search, and Group pages to
|
||||
show the times instead of the period numbers. Period numbers are
|
||||
still shown in the results tables with mouse hover showing times.
|
||||
- Moved all installation/upgrade functions to the install.sh script.
|
||||
|
||||
1.1.1 - 2020-04-09
|
||||
- Fixed opendrs-update.sql to rename the trainers table.
|
||||
- Fixed bug where the About page didn't show the version number.
|
||||
- Fixed some grammar on the About page.
|
||||
- Fixed hardcoded help text in groups.php to use constant from config.
|
||||
- Added ID to searchable parameters in search.php.
|
||||
- Added sort parameters to search results.
|
||||
- Added a link for Admins to access the local Webmin to manage a terminal.
|
||||
- For Raspberry Pi:
|
||||
- In terminal setup, provided missing .profile and
|
||||
.config/openbox/rc.xml files.
|
||||
- In server setup, install mariadb-server since
|
||||
mysql-server is obsolete.
|
||||
- Changed startdrs.sh to re-enable ctrl keys for copy/paste, etc. Also
|
||||
added chromium flags to prevent update popup.
|
||||
- Added openbox keybindings to customer user's rc.xml to trap dangerous
|
||||
chromium hotkey combinations and enable ctrl-alt-del reboot.
|
||||
- Changed systemd ctrl-alt-del.target symlink to point to
|
||||
reboot.target.
|
||||
|
||||
|
||||
2
INSTALL
@@ -14,7 +14,7 @@ follow the prompts.
|
||||
4. Log in
|
||||
Click on the Log In menu option on the main page. If this is a fresh
|
||||
installation The initial user is drsadmin and the initial password
|
||||
is OpenDRS-1. It is highly recommended that you changethis password
|
||||
is OpenDRS-1. It is highly recommended that you change this password
|
||||
to a strong one by going to the Manage Database page under the
|
||||
Admin Functions menu. If this an upgrade, your current usernames and
|
||||
passwords are unchanged.
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
|
||||
# server-setup.sh
|
||||
# OpenDRS Online Discrepancy Reporting System
|
||||
# Copyright (C) 2018 Rod Wright
|
||||
# Copyright (C) 2020 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
inst_name="OpenDRS"
|
||||
docroot_path="/var/www"
|
||||
apache_user="www-data"
|
||||
apache_group="www-data"
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
@@ -30,6 +35,8 @@ sleep 10
|
||||
apt update && apt dist-upgrade -y
|
||||
echo "...done."
|
||||
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"
|
||||
@@ -37,7 +44,7 @@ echo "generate a random password(leave the field blank)."
|
||||
echo -n "Press enter to continue."
|
||||
read continueok
|
||||
sleep 10
|
||||
apt install -y apache2 php php-mcrypt mysql-server phpmyadmin
|
||||
apt install -y apache2 php php-mcrypt mariadb-server phpmyadmin uuid-runtime
|
||||
cp etc/apache2/mods-available/alias.conf /etc/apache2/mods-available
|
||||
service apache2 restart
|
||||
echo "...done."
|
||||
@@ -51,34 +58,168 @@ mysql_secure_installation
|
||||
mysql mysql -e "update user set plugin='';flush privileges;"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Installing OpenDRS."
|
||||
DRS_VERSION="1.1.0"
|
||||
install_path="/var/www/opendrs-$DRS_VERSION"
|
||||
httpd_user_group="www-data:www-data"
|
||||
new_link_name="/var/www/opendrs"
|
||||
|
||||
# This is a fresh install
|
||||
operation="installed"
|
||||
# prompt for mysql information
|
||||
bad_mysql_adm=1
|
||||
while [ $bad_mysql_adm -eq 1 ]
|
||||
do
|
||||
admintestdb="drsadm`date +%Y%m%d`"
|
||||
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 -n "MySQL admin username: "
|
||||
read mysql_adm_user
|
||||
echo ""
|
||||
echo -n "MySQL admin password: "
|
||||
read -s mysql_adm_pass
|
||||
export MYSQL_PWD="$mysql_adm_pass"
|
||||
mysql -u"$mysql_adm_user" -e "create database $admintestdb;drop database $admintestdb"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
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]: "
|
||||
read admtry
|
||||
if [ "$admtry" != "Y" -o "$admtry" != "y" ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
echo "What would you like to call this installation of OpenDRS? If you accept"
|
||||
echo "the default, it will be called $inst_name. If you will be running multiple"
|
||||
echo "instances of OpenDRS on this server, you should choose a distinctive name."
|
||||
echo -n "Installation name [$inst_name]: "
|
||||
read inst_name
|
||||
echo ""
|
||||
|
||||
# Create initial database
|
||||
db_create_fail=1
|
||||
while [ $db_create_fail -eq 1 ]
|
||||
do
|
||||
name_valid=0
|
||||
while [ $name_valid -eq 0 ]
|
||||
do
|
||||
echo "What would you like to call the database for this installation of OpenDRS?"
|
||||
echo "If you accept the default or make it blank, it will be $inst_name."
|
||||
echo "Spaces or special characters are not allowed in the name."
|
||||
echo -n "database name [$inst_name]: "
|
||||
read new_db_name
|
||||
if [ "$new_db_name" = "" ]
|
||||
then
|
||||
new_db_name=$inst_name
|
||||
fi
|
||||
echo $new_db_name|egrep -q "\W"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "The name you entered seems to contain whitespace or special"
|
||||
echo "characters. Try again or just accept the default."
|
||||
else
|
||||
name_valid=1
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
export MYSQL_PWD="$mysql_adm_pass"
|
||||
mysql -u"$mysql_adm_user" -e "create database $new_db_name"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
db_create_fail=0
|
||||
else
|
||||
echo "An error was encountered when trying to create the database."
|
||||
echo "This probably means the database already exists."
|
||||
echo -n "Try again with a different database name? [Y/N]: "
|
||||
read dbcreatetry
|
||||
if [ "$dbcreatetry" != "Y" -o "$dbcreatetry" != "y" ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Create user and give rights to database
|
||||
drs_user="$new_db_name-user"
|
||||
drs_pass=`uuidgen`
|
||||
export MYSQL_PWD="$mysql_adm_pass"
|
||||
mysql -u"$mysql_adm_user" -e "create user if not exists '$drs_user'@'localhost' identified by '$drs_pass'"
|
||||
mysql -u"$mysql_adm_user" -e "grant all on $new_db_name.* to '$drs_user'@'localhost'"
|
||||
mysql -u"$mysql_adm_user" -e "flush privileges"
|
||||
|
||||
# Populate initial database
|
||||
mysql -u"$mysql_adm_user" $new_db_name < ../opendrs-initial.sql
|
||||
|
||||
# Set the installation name
|
||||
export MYSQL_PWD="$drs_pass"
|
||||
mysql -u"$drs_user" $new_db_name -e "update config set value=\"$inst_name\",defaultvalue=\"$inst_name\" where name=\"app_name\""
|
||||
|
||||
# Create install path
|
||||
echo "Creating installation directory . . ."
|
||||
install_path=$docroot_path/$inst_name
|
||||
mkdir $install_path
|
||||
|
||||
# Create db.php if it doesn't exist
|
||||
if [ ! -f "$install_path/db.php" ]
|
||||
then
|
||||
cp ../db.php.template $install_path/db.php
|
||||
sed -i "s/DBNAME/$new_db_name/g" $install_path/db.php
|
||||
sed -i "s/DBUSER/$drs_user/g" $install_path/db.php
|
||||
sed -i "s/DBPASS/$drs_pass/g" $install_path/db.php
|
||||
fi
|
||||
|
||||
# copy distribution to install location
|
||||
echo "Installing distribution . . ."
|
||||
cp -Rv ../distfiles/* $install_path
|
||||
ln -s $install_path/writeups.php $install_path/index.php
|
||||
|
||||
# set ownership
|
||||
echo "In order to set the ownership correctly, we need to know the user and"
|
||||
echo "group that the webserver expects its files to be owned by. This is"
|
||||
echo "usually not the root account. Refer to the ownership of other files in"
|
||||
echo "your webserver's document tree to see what this should be."
|
||||
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
|
||||
echo ""
|
||||
echo "Setting file ownership . . ."
|
||||
chown -R $httpd_user_group $install_path
|
||||
ln -s $install_path $new_link_name
|
||||
cp etc/apache2/conf-available/opendrs.conf /etc/apache2/conf-available
|
||||
cp etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available
|
||||
a2enconf opendrs
|
||||
echo "DRS_SERVER=\"http://localhost\"" > /etc/drs.conf
|
||||
service apache2 restart
|
||||
|
||||
echo ""
|
||||
echo "Server configuration is now complete. "
|
||||
echo "Once the reboot is complete you will need to do the final installation of OpenDRS through"
|
||||
echo "the browser. You will need the password you set during the mysql installation above."
|
||||
|
||||
# tell user to launch web browser to continue
|
||||
echo ""
|
||||
echo ""
|
||||
echo "It is highly recommended that after rebooting, you press ctrl-alt-F2,"
|
||||
echo "log in as pi, then create new users for yourself and any other"
|
||||
echo "administrators using the cloneuser command (cloneuser pi newlogin)."
|
||||
echo ""
|
||||
echo "OpenDRS has been installed."
|
||||
|
||||
echo "# OpenDRS default Apache configuration" > /etc/apache2/conf-available/$inst_name.conf
|
||||
echo "" >> /etc/apache2/conf-available/$inst_name.conf
|
||||
echo "Alias /$inst_name $install_path" >> /etc/apache2/conf-available/$inst_name.conf
|
||||
echo "" >> /etc/apache2/conf-available/$inst_name.conf
|
||||
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
|
||||
|
||||
a2enconf $inst_name
|
||||
service apache2 reload
|
||||
echo "OpenDRS server setup is complete."
|
||||
echo ""
|
||||
echo "Once the reboot is complete you will need to do the final installation of $inst_name through"
|
||||
echo "the browser. You will need the mysql username and password you set during the mysql installation above."
|
||||
echo ""
|
||||
echo ""
|
||||
echo -n "Press enter to reboot now."
|
||||
read rebootok
|
||||
reboot
|
||||
echo "Once the final install is done, you will need to log in to $inst_name to configure it."
|
||||
echo "IMPORTANT: The default login credentials for the initial admin user are:"
|
||||
echo ""
|
||||
echo "login: drsadmin"
|
||||
echo "password: OpenDRS-1"
|
||||
echo ""
|
||||
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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# terminal-setup.sh
|
||||
# OpenDRS Online Maintenance Tracking System
|
||||
# Copyright (C) 2018 Rod Wright
|
||||
# Copyright (C) 2020 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
@@ -46,8 +46,6 @@ chmod +x usr/local/bin/*
|
||||
cp usr/local/bin/* /usr/local/bin
|
||||
cp etc/apt/sources.list.d/* /etc/apt/sources.list.d
|
||||
cp lib/systemd/system/getty@tty1.service /lib/systemd/system
|
||||
rm /lib/systemd/system/ctrl-alt-del.target
|
||||
ln -s /dev/null /lib/systemd/system/ctrl-alt-del.target
|
||||
echo "...done."
|
||||
echo ""
|
||||
echo ""
|
||||
@@ -80,7 +78,7 @@ read continueok
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Creating customer user..."
|
||||
cloneuser pi customer
|
||||
cloneuser `who am i | awk '{print $1}'` customer
|
||||
mkdir -p /home/customer/.config/openbox
|
||||
cp home/customer/.profile /home/customer
|
||||
cp home/customer/.config/openbox/rc.xml /home/customer/.config/openbox
|
||||
@@ -89,32 +87,27 @@ echo "...done."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "This terminal will need to communicate with an OpenDRS server. If"
|
||||
echo "you intend to host the server directly on this terminal, accept the"
|
||||
echo "default URL shown. Otherwise, enter the server URL."
|
||||
echo -n "[http://localhost] :"
|
||||
echo "you intend to host the server directly on this terminal, leave this"
|
||||
echo -n "blank. Otherwise, enter the server URL :"
|
||||
read server_url
|
||||
if [[ $server_url == "" ]]
|
||||
then
|
||||
server_url="http://localhost"
|
||||
fi
|
||||
echo "DRS_SERVER=\"$server_url\"" > /etc/drs.conf
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Terminal configuration is now complete. "
|
||||
echo ""
|
||||
echo ""
|
||||
echo "If this Raspberry Pi will also be used as the OpenDRS server, you will need"
|
||||
echo "to run the server-setup.sh script in this same directory."
|
||||
echo "Would you like to do that now? enter Y if so, or press enter to leave this"
|
||||
echo -n "as a terminal only and reboot :"
|
||||
read serverchoice
|
||||
if [[ $serverchoice == "Y" || $serverchoice == "y" ]]
|
||||
then
|
||||
conftype="Server/Terminal"
|
||||
touch /etc/drs.conf
|
||||
./server-setup.sh
|
||||
else
|
||||
conftype="Terminal"
|
||||
echo "DRS_SERVER=\"$server_url\"" > /etc/drs.conf
|
||||
fi
|
||||
echo "It is highly recommended that after rebooting, you press ctrl-alt-F2,"
|
||||
echo "log in as pi, then create new users for yourself and any other"
|
||||
echo "administrators using the cloneuser command (cloneuser pi newlogin)."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "$conftype configuration is now complete. "
|
||||
echo ""
|
||||
echo ""
|
||||
echo "It is highly recommended that after rebooting, you run ssh pi@$HOSTNAME"
|
||||
echo "from another computer on the network, then create new users for"
|
||||
echo "yourself and any other administrators using the cloneuser command"
|
||||
echo "(cloneuser pi <new username>)."
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Setup complete."
|
||||
|
||||
@@ -2,17 +2,27 @@
|
||||
SRC=$1
|
||||
DEST=$2
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: cloneuser source_user destination_user"
|
||||
exit 1
|
||||
fi
|
||||
if ! grep -q $SRC /etc/passwd ;then echo "Source user doesn't exist!"; exit 1; fi
|
||||
if grep -q $DEST /etc/passwd ;then echo "Destination user already exists!"; exit 1; fi
|
||||
|
||||
SRC_GROUPS=`id -Gn ${SRC}`
|
||||
SRC_SHELL=$(awk -F : -v name=${SRC} '(name == $1) { print $7 }' /etc/passwd)
|
||||
RAND_PW=`date +%s | sha256sum | base64 | head -c 32 ; echo`
|
||||
|
||||
echo "Creating user $DEST"
|
||||
useradd --shell ${SRC_SHELL} --create-home ${DEST}
|
||||
echo "Creating user $DEST with a random password"
|
||||
useradd --shell ${SRC_SHELL} --password ${RAND_PW} --create-home ${DEST}
|
||||
for grp in ${SRC_GROUPS};do
|
||||
if [ "$grp" != "$SRC" ]; then
|
||||
echo "Adding user $DEST to group $grp."
|
||||
usermod -a -G $grp ${DEST}
|
||||
fi
|
||||
done
|
||||
passwd ${DEST}
|
||||
echo "Finished. Please set an actual password for $DEST if you want them to be able to log in."
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,18 +7,16 @@ openbox-session &
|
||||
xset s off
|
||||
xset +dpms
|
||||
xset dpms 0 600 1800
|
||||
|
||||
#xset dpms force off
|
||||
|
||||
|
||||
while true
|
||||
do
|
||||
killall chromium-browser
|
||||
rm -rf ~/.{config,cache}/chromium/
|
||||
|
||||
# start browser in your web site: here, just plain old localhost
|
||||
# -test-type will ignore any warnings and
|
||||
# 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 --incognito $DRS_SERVER &
|
||||
chromium-browser --test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito $DRS_SERVER &
|
||||
|
||||
sleep 10
|
||||
|
||||
@@ -27,8 +25,8 @@ do
|
||||
pgrep chromium-browse
|
||||
if [ "$?" -eq "1" ]
|
||||
then
|
||||
# here you could execute something that is supposed to happen after the browser was accidentally quit
|
||||
chromium-browser -test-type --ignore-certificate-errors --kiosk --no-first-run --incognito $DRS_SERVER &
|
||||
# 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 &
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
boilerplate.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
db.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
OpenDRS - Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -27,17 +27,37 @@ Changelog
|
||||
back button in terminal mode.
|
||||
- Added configurable help text for period effective selection.
|
||||
- Changed Sim period effective from selection to yes/no radio buttons.
|
||||
- Writeup groups page shows collapsed list of groups. Click the expand icon
|
||||
to expand each group.
|
||||
- Fixed bug where entries made on stale create page had inaccurate date/time.
|
||||
- For logged in users, added the ability to select writeups directly on the
|
||||
View All Writeups page and assign/create a group.
|
||||
- On the Create New Writeup page, removed the default selections for Device,
|
||||
Subsystem, and Period dropdowns, forcing user to make a selection.
|
||||
- Writeup groups page shows collapsed list of groups. Click the expand
|
||||
icon to expand each group.
|
||||
- Fixed bug where entries made on stale create page had inaccurate
|
||||
date/time.
|
||||
- For logged in users, added the ability to select writeups directly on
|
||||
the View All Writeups page and assign/create a group.
|
||||
- On the Create New Writeup page, removed the default selections for
|
||||
Device, Subsystem, and Period dropdowns, forcing user to make a
|
||||
selection.
|
||||
- Added a Today button to the View All Writeups page
|
||||
- Changed the Period dropdowns on the Create, Search, and Group pages to show
|
||||
the times instead of the period numbers. Period numbers are still shown
|
||||
in the results tables with mouse hover showing times.
|
||||
- Changed the Period dropdowns on the Create, Search, and Group pages to
|
||||
show the times instead of the period numbers. Period numbers are
|
||||
still shown in the results tables with mouse hover showing times.
|
||||
- Moved all installation/upgrade functions to the install.sh script.
|
||||
|
||||
|
||||
1.1.1 - 2020-04-09
|
||||
- Fixed opendrs-update.sql to rename the trainers table.
|
||||
- Fixed bug where the About page didn't show the version number.
|
||||
- Fixed some grammar on the About page.
|
||||
- Fixed hardcoded help text in groups.php to use constant from config.
|
||||
- Added ID to searchable parameters in search.php.
|
||||
- Added sort parameters to search results.
|
||||
- Added a link for Admins to access the local Webmin to manage a terminal.
|
||||
- For Raspberry Pi:
|
||||
- In terminal setup, provided missing .profile and
|
||||
.config/openbox/rc.xml files.
|
||||
- In server setup, install mariadb-server since
|
||||
mysql-server is obsolete.
|
||||
- Changed startdrs.sh to re-enable ctrl keys for copy/paste, etc. Also
|
||||
added chromium flags to prevent update popup.
|
||||
- Added openbox keybindings to customer user's rc.xml to trap dangerous
|
||||
chromium hotkey combinations and enable ctrl-alt-del reboot.
|
||||
- Changed systemd ctrl-alt-del.target symlink to point to
|
||||
reboot.target.
|
||||
|
||||
@@ -14,7 +14,7 @@ follow the prompts.
|
||||
4. Log in
|
||||
Click on the Log In menu option on the main page. If this is a fresh
|
||||
installation The initial user is drsadmin and the initial password
|
||||
is OpenDRS-1. It is highly recommended that you changethis password
|
||||
is OpenDRS-1. It is highly recommended that you change this password
|
||||
to a strong one by going to the Manage Database page under the
|
||||
Admin Functions menu. If this an upgrade, your current usernames and
|
||||
passwords are unchanged.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
about.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -39,6 +39,7 @@ if ($print) {
|
||||
|
||||
// assign variables from constants
|
||||
$appname=APP_NAME;
|
||||
$drs_version=DRS_VERSION;
|
||||
|
||||
if ($print=="Printer Friendly") {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
@@ -72,7 +73,7 @@ echo "<br>";
|
||||
|
||||
echo "
|
||||
<h3 align=\"center\">
|
||||
OpenDRS $version Discrepancy Reporting System
|
||||
OpenDRS $drs_version Discrepancy Reporting System
|
||||
</h3><br>
|
||||
<p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link
|
||||
or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2018 by Rod Wright.
|
||||
@@ -119,7 +120,7 @@ server.</td>
|
||||
<tr>
|
||||
<td><a href=\"http://p.yusukekamiyamane.com\" target=\"_blank\"><img src=\"images/Kamiyamane.png\"
|
||||
border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenDRS are from the Fugue Icon set created by Yusuke Kamiyamane. The entire set is available at
|
||||
<a href=\"http://p.yusukekamiyamane.com/\" target=\"_blank\">p.yusukekamiyamane.com</a>, and are licensed under a
|
||||
<a href=\"http://p.yusukekamiyamane.com/\" target=\"_blank\">p.yusukekamiyamane.com</a>, and is licensed under the
|
||||
<a href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\">Creative Commons Attribution 3.0 License</a>.</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
common.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -357,7 +357,7 @@ function sidemenu($printable=true) {
|
||||
echo "
|
||||
<br>
|
||||
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
|
||||
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View open writeups\"><font size=\"+1\"><b>View Open Writeups</b></font></a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View open writeups\">View Open Writeups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"writeups.php?view=1\" title=\"View all writeups for a date range\">View All Writeups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
|
||||
@@ -374,6 +374,7 @@ function sidemenu($printable=true) {
|
||||
<tr><td align=\"center\"><b>Admin Functions</b></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"config.php\" title=\"Control global settings. Must be an administrator.\">Global Settings</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"dbadmin.php\" title=\"Manage the database. Must be an administrator.\">Manage Database</a></td></tr>
|
||||
<tr><td align=\"center\"><a href=\"https://localhost:10000\" title=\"Webmin for managing a terminal. Webmin must be running on localhost.\">Manage Terminal</a></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
config.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
create.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
dbadmin.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
gpl.php
|
||||
OpenMTS Online Maintenance Tracking System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
groups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -490,8 +490,7 @@ if ($action=="add") {
|
||||
";
|
||||
// Period effective cell ************
|
||||
echo "
|
||||
Sim period effective? <img src=\"icons/question.png\" title=\"If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective.
|
||||
Otherwise, answer Effective. \"><br>
|
||||
Sim period effective? <img src=\"icons/question.png\" title=\"" . PERIOD_EFF_HELP_TXT . "\"><br>
|
||||
";
|
||||
if ($search) {
|
||||
$effstate=$nefstate="";
|
||||
|
||||
|
Before Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 551 B |
|
Before Width: | Height: | Size: 564 B |
|
Before Width: | Height: | Size: 470 B |
|
Before Width: | Height: | Size: 696 B |
|
Before Width: | Height: | Size: 811 B |
|
Before Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 811 B |
|
Before Width: | Height: | Size: 548 B |
|
Before Width: | Height: | Size: 757 B |
|
Before Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 521 B |
|
Before Width: | Height: | Size: 761 B |
|
Before Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 592 B |
|
Before Width: | Height: | Size: 481 B |
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
login.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
profile.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
search.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -42,9 +42,12 @@ $s_action_by=$incoming['s_action_by'];
|
||||
$s_action_reason=$incoming['s_action_reason'];
|
||||
$s_action_text=$incoming['s_action_text'];
|
||||
$s_subsystem=$incoming['s_subsystem'];
|
||||
$s_id=$incoming['s_id'];
|
||||
$s_discrepancy_text=$incoming['s_discrepancy_text'];
|
||||
$s_status=$incoming['s_status'];
|
||||
$s_group=$incoming['s_group'];
|
||||
$sort=$incoming['sort'];
|
||||
$order=$incoming['order'];
|
||||
|
||||
// assign variables from constants
|
||||
$appname=APP_NAME;
|
||||
@@ -79,6 +82,7 @@ if ($search) {
|
||||
$s_reported_by=trim($s_reported_by);
|
||||
$s_action_text=trim($s_action_text);
|
||||
$s_discrepancy_text=trim($s_discrepancy_text);
|
||||
$s_id=trim($s_id);
|
||||
|
||||
// build the query string
|
||||
$query_string="";
|
||||
@@ -114,6 +118,16 @@ if ($search) {
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
}
|
||||
// id
|
||||
if ($s_id) {
|
||||
$query_string="{$query_string}(";
|
||||
$query_string="{$query_string}id={$s_id}";
|
||||
$query_string="{$query_string})";
|
||||
$query_string="{$query_string} and ";
|
||||
$id_param="ID: {$s_id}";
|
||||
} else {
|
||||
$id_param="ID: any";
|
||||
}
|
||||
// period
|
||||
if ($s_period) {
|
||||
$query_string="{$query_string}(";
|
||||
@@ -265,7 +279,7 @@ if ($search) {
|
||||
}
|
||||
|
||||
$query_string=rtrim($query_string," and ");
|
||||
$query_string="select * from writeups where {$query_string} order by report_date asc";
|
||||
$query_string="select * from writeups where {$query_string} order by $sort $order";
|
||||
|
||||
// group membership
|
||||
if ($s_group) {
|
||||
@@ -301,6 +315,16 @@ if (!$print) {
|
||||
<tr>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// ID cell *****************
|
||||
echo "
|
||||
ID<br>
|
||||
<input type=\"text\" name=\"s_id\" size=\"10\" value=\"$s_id\">
|
||||
";
|
||||
// **********************************
|
||||
echo "
|
||||
</td>
|
||||
<td align=\"left\">
|
||||
";
|
||||
// Device cell *********************
|
||||
echo "
|
||||
Device<br>
|
||||
@@ -340,7 +364,7 @@ if (!$print) {
|
||||
";
|
||||
// **********************************
|
||||
echo "
|
||||
</td><td></td>
|
||||
</td>
|
||||
";
|
||||
echo "
|
||||
</tr>
|
||||
@@ -566,6 +590,44 @@ if (!$print) {
|
||||
} else {
|
||||
$summarystat="checked";
|
||||
}
|
||||
$idsort=$statussort=$datesort=$periodsort=$devicesort=$subsyssort=$repbysort=$discrepsort=$effsort="";
|
||||
switch ($sort) {
|
||||
case "id":
|
||||
$idsort="checked";
|
||||
break;
|
||||
case "status":
|
||||
$statussort="checked";
|
||||
break;
|
||||
case "report_date":
|
||||
$datesort="checked";
|
||||
break;
|
||||
case "period":
|
||||
$periodsort="checked";
|
||||
break;
|
||||
case "device":
|
||||
$devicesort="checked";
|
||||
break;
|
||||
case "subsystem":
|
||||
$subsyssort="checked";
|
||||
break;
|
||||
case "reported_by":
|
||||
$repbysort="checked";
|
||||
break;
|
||||
case "discrepancy_text":
|
||||
$discrepsort="checked";
|
||||
break;
|
||||
case "period_effective":
|
||||
$effsort="checked";
|
||||
break;
|
||||
default:
|
||||
$datesort="checked";
|
||||
}
|
||||
$ascsort=$descsort="";
|
||||
if ($order=="desc") {
|
||||
$descsort="checked";
|
||||
} else {
|
||||
$ascsort="checked";
|
||||
}
|
||||
echo "</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -573,6 +635,20 @@ if (!$print) {
|
||||
<input type=\"radio\" $summarystat name=\"viewtype\" value=\"summary\" id=\"summaryview\" ><label for=\"summaryview\" title=\"Show one writeup per line with minimal detail.\">Results in summary view</label>
|
||||
<input type=\"radio\" $detailstat name=\"viewtype\" value=\"detail\" id=\"detailview\"><label for=\"detailview\" title=\"Show each writeup's full details.\">Results in detail view</label>
|
||||
<br><br>
|
||||
Sort Field:<br>
|
||||
<input type=\"radio\" $idsort name=\"sort\" value=\"id\" id=\"idview\" ><label for=\"idview\" title=\"Sort by ID.\">ID</label>
|
||||
<input type=\"radio\" $statussort name=\"sort\" value=\"status\" id=\"statusview\" ><label for=\"statusview\" title=\"Sort by Status.\">Status</label>
|
||||
<input type=\"radio\" $datesort name=\"sort\" value=\"report_date\" id=\"dateview\" ><label for=\"dateview\" title=\"Sort by Report Date.\">Date</label>
|
||||
<input type=\"radio\" $periodsort name=\"sort\" value=\"period\" id=\"periodview\" ><label for=\"periodview\" title=\"Sort by Period.\">Period</label>
|
||||
<input type=\"radio\" $devicesort name=\"sort\" value=\"device\" id=\"deviceview\" ><label for=\"deviceview\" title=\"Sort by Device.\">Device</label>
|
||||
<input type=\"radio\" $subsyssort name=\"sort\" value=\"subsystem\" id=\"subsysview\" ><label for=\"subsysview\" title=\"Sort by Subsystem.\">Subsystem</label>
|
||||
<input type=\"radio\" $repbysort name=\"sort\" value=\"reported_by\" id=\"repbyview\" ><label for=\"repbyview\" title=\"Sort by Reported by.\">Reported by</label>
|
||||
<input type=\"radio\" $discrepsort name=\"sort\" value=\"discrepancy_text\" id=\"discrepview\" ><label for=\"discrepview\" title=\"Sort by Discrepancy.\">Discrepancy</label>
|
||||
<input type=\"radio\" $effsort name=\"sort\" value=\"period_effective\" id=\"effview\" ><label for=\"effview\" title=\"Sort by Mission Effective.\">Msn Eff</label>
|
||||
<br>Sort Order:<br>
|
||||
<input type=\"radio\" $ascsort name=\"order\" value=\"asc\" id=\"ascview\" ><label for=\"ascview\" title=\"Sort results in ascending order.\">Ascending</label>
|
||||
<input type=\"radio\" $descsort name=\"order\" value=\"desc\" id=\"descview\" ><label for=\"descview\" title=\"Sort results in descending order.\">Descending</label>
|
||||
<br><br>
|
||||
<input type=\"submit\" name=\"search\" value=\"Search\">
|
||||
|
||||
<input type=\"submit\" name=\"cancel\" value=\"Start New Search\">
|
||||
@@ -602,6 +678,7 @@ if ($search) {
|
||||
<td><b>$status_param</b></td><td> </td>
|
||||
<td>$device_param</td><td> </td>
|
||||
<td>$subsystem_param</td><td> </td>
|
||||
<td>$id_param</td><td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border=\"0\">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
settings.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
writeupdetail.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
writeups.php
|
||||
OpenDRS Online Discrepancy Reporting System
|
||||
Copyright (C) 2018 Rod Wright
|
||||
Copyright (C) 2020 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
@@ -58,7 +58,6 @@ function opentable($start_date,$end_date,$print,$drs_db,$viewtype="summary") {
|
||||
";
|
||||
if ($print) {
|
||||
echo "
|
||||
<form method=post action=\"writeups.php\">
|
||||
Open writeups between $start_date and $end_date
|
||||
";
|
||||
} else {
|
||||
@@ -175,20 +174,27 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
echo "
|
||||
<form method=post action=\"writeups.php\">
|
||||
<input type=\"hidden\" name=\"view\" value=\"1\">
|
||||
Writeups between
|
||||
<input type=\"text\" name=\"start_date\" size=\"10\" value=\"$start_date\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\"> and
|
||||
<input type=\"text\" name=\"end_date\" size=\"10\" value=\"$end_date\" id=\"enddatepicker\" title=\"Format: YYYY-MM-DD\">
|
||||
";
|
||||
if(!$print) {
|
||||
echo "
|
||||
<input type=\"submit\" name=\"update\" value=\"Update\">
|
||||
<input type=\"submit\" name=\"showtoday\" value=\"Today\">
|
||||
<input type=\"submit\" name=\"showyesterday\" value=\"Yesterday\">
|
||||
<input type=\"submit\" name=\"show7day\" value=\"Last 7 Days\">
|
||||
<input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\"><br><br>
|
||||
<input type=\"submit\" name=\"show30day\" value=\"Last 30 Days\">
|
||||
";
|
||||
}
|
||||
echo "
|
||||
Writeups between
|
||||
<input type=\"text\" name=\"start_date\" size=\"10\" value=\"$start_date\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\"> and
|
||||
<input type=\"text\" name=\"end_date\" size=\"10\" value=\"$end_date\" id=\"enddatepicker\" title=\"Format: YYYY-MM-DD\"><br><br>
|
||||
";
|
||||
if(!$print) {
|
||||
echo "
|
||||
<input type=\"radio\" $summarystat name=\"viewtype\" value=\"summary\" id=\"summaryview\" ><label for=\"summaryview\" title=\"Show one writeup per line with minimal detail.\">Results in summary view</label>
|
||||
<input type=\"radio\" $detailstat name=\"viewtype\" value=\"detail\" id=\"detailview\"><label for=\"detailview\" title=\"Show each writeup's full details.\">Results in detail view</label>
|
||||
<br><br>";
|
||||
<input type=\"submit\" name=\"update\" value=\"Update\">
|
||||
<br><br>
|
||||
";
|
||||
}
|
||||
$writeup=mysqli_query($drs_db,"select * from writeups where report_date between \"$start_date\" and \"$end_date\" order by report_date desc,period desc,report_time desc");
|
||||
if (mysqli_num_rows($writeup)) {
|
||||
@@ -306,7 +312,7 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
if ($role) {
|
||||
echo "
|
||||
<br><br>
|
||||
<button name=\"addtogroup\" value=\"addtogroup\" type=\"submit\">Add selected to group:</button> <select name=\"togroup\" id=\"sel-togroup\">
|
||||
Add selected to group: <select name=\"togroup\" id=\"sel-togroup\">
|
||||
<option value=\"newgroup\">New group</option>
|
||||
";
|
||||
$tgrow=mysqli_query($drs_db,"select id,name from groups order by id asc");
|
||||
@@ -315,6 +321,7 @@ function viewtable($start_date,$end_date,$print,$drs_db,$viewtype="summary",$rol
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
<button name=\"addtogroup\" value=\"addtogroup\" type=\"submit\">Submit</button>
|
||||
";
|
||||
}
|
||||
} else {
|
||||
|
||||
74
install.sh
@@ -2,12 +2,12 @@
|
||||
|
||||
# install.sh
|
||||
# OpenDRS Online Discrepancy Reporting System
|
||||
# Copyright (C) 2018 Rod Wright
|
||||
# Copyright (C) 2020 Rod Wright
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
|
||||
DRS_VERSION="1.1.0"
|
||||
DRS_VERSION="1.1.1"
|
||||
DOC_ROOT="/var/www"
|
||||
INSTALL_LOC="opendrs"
|
||||
APACHE_USER="www-data"
|
||||
@@ -42,15 +42,6 @@ echo ""
|
||||
echo -n "Enter name of OpenDRS installation directory [$INSTALL_LOC] :"
|
||||
read install_loc_in
|
||||
echo ""
|
||||
echo "In order to set the ownership correctly, we need to know the user and"
|
||||
echo "group that the webserver expects its files to be owned by. This is"
|
||||
echo "usually not the root account. Refer to the ownership of other files in"
|
||||
echo "your webserver's document tree to see what this should be."
|
||||
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
|
||||
echo ""
|
||||
if [ "$doc_root_in" = "" ]
|
||||
then
|
||||
doc_root_in=$DOC_ROOT
|
||||
@@ -59,10 +50,6 @@ if [ "$install_loc_in" = "" ]
|
||||
then
|
||||
install_loc_in=$INSTALL_LOC
|
||||
fi
|
||||
if [ "$httpd_user_group" = "" ]
|
||||
then
|
||||
httpd_user_group="$APACHE_USER:$APACHE_GROUP"
|
||||
fi
|
||||
install_path="$doc_root_in/$install_loc_in"
|
||||
if [ -d "$install_path" ]
|
||||
then
|
||||
@@ -90,22 +77,36 @@ then
|
||||
curr_dbname=`grep dbname $install_path/db.php | head -1 | cut -d "\"" -f2`
|
||||
curr_username=`grep username $install_path/db.php | head -1 | cut -d "\"" -f2`
|
||||
curr_dbpass=`grep dbpass $install_path/db.php | head -1 | cut -d "\"" -f2`
|
||||
mysqldump -u"$curr_username" -p"$curr_dbpass" $curr_dbname > $curr_dbname-`date +%Y-%m-%d_%H:%M:%S`-backup.sql
|
||||
export MYSQL_PWD="$curr_dbpass"
|
||||
mysqldump -u"$curr_username" $curr_dbname > $curr_dbname-`date +%Y-%m-%d_%H:%M:%S`-backup.sql
|
||||
# back up existing installation
|
||||
echo "Backing up current installation to the package directory."
|
||||
cp -R $install_path $install_loc_in-`date +%Y-%m-%d_%H:%M:%S`-backup
|
||||
# delete all existing installation files except db.php
|
||||
find $install_path/ -mindepth 1 -not -name 'db.php' -delete
|
||||
# apply database updates
|
||||
mysql -u"$curr_username" -p"$curr_dbpass" $curr_dbname < opendrs-update.sql
|
||||
mysql -u"$curr_username" $curr_dbname < opendrs-update.sql >/dev/null 2>&1
|
||||
# apply updates to existing db.php
|
||||
./opendrs-update.sh $install_path
|
||||
# copy distribution to install location
|
||||
echo "Installing distribution . . ."
|
||||
cp -R distfiles/* $install_path
|
||||
# set ownership
|
||||
echo "In order to set the ownership correctly, we need to know the user and"
|
||||
echo "group that the webserver expects its files to be owned by. This is"
|
||||
echo "usually not the root account. Refer to the ownership of other files in"
|
||||
echo "your webserver's document tree to see what this should be."
|
||||
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
|
||||
if [ "$httpd_user_group" = "" ]
|
||||
then
|
||||
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
|
||||
else
|
||||
echo "Cancelling installation"
|
||||
exit
|
||||
@@ -138,7 +139,8 @@ else
|
||||
echo ""
|
||||
echo -n "MySQL admin password: "
|
||||
read -s mysql_adm_pass
|
||||
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "create database $admintestdb;drop database $admintestdb" 2>/dev/null
|
||||
export MYSQL_PWD="$mysql_adm_pass"
|
||||
mysql -u"$mysql_adm_user" -e "create database $admintestdb;drop database $admintestdb"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
bad_mysql_adm=0
|
||||
@@ -171,8 +173,13 @@ else
|
||||
echo "distinctive name."
|
||||
echo -n "database name [opendrs]: "
|
||||
read new_db_name
|
||||
if [ "$new_db_name" = "" ]
|
||||
then
|
||||
new_db_name=opendrs
|
||||
fi
|
||||
echo ""
|
||||
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "create database $new_db_name" 2>/dev/null
|
||||
export MYSQL_PWD="$mysql_adm_pass"
|
||||
mysql -u"$mysql_adm_user" -e "create database $new_db_name"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
db_create_fail=0
|
||||
@@ -191,15 +198,17 @@ else
|
||||
# Create user and give rights to database
|
||||
drs_user="$new_db_name`date +%Y%m%d%H%M%S`"
|
||||
drs_pass=`uuidgen`
|
||||
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "create user if not exists '$drs_user'@'localhost' identified by '$drs_pass'" 2>/dev/null
|
||||
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "grant all on $new_db_name.* to '$drs_user'@'localhost'"
|
||||
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" -e "flush privileges"
|
||||
export MYSQL_PWD="$mysql_adm_pass"
|
||||
mysql -u"$mysql_adm_user" -e "create user if not exists '$drs_user'@'localhost' identified by '$drs_pass'"
|
||||
mysql -u"$mysql_adm_user" -e "grant all on $new_db_name.* to '$drs_user'@'localhost'"
|
||||
mysql -u"$mysql_adm_user" -e "flush privileges"
|
||||
|
||||
# Populate initial database
|
||||
mysql -u"$mysql_adm_user" -p"$mysql_adm_pass" $new_db_name < opendrs-initial.sql 2>/dev/null
|
||||
mysql -u"$mysql_adm_user" $new_db_name < opendrs-initial.sql
|
||||
|
||||
# Set the installation name
|
||||
mysql -u"$drs_user" -p"$drs_pass" $new_db_name -e "update config set value=\"$new_inst_name\",defaultvalue=\"$new_inst_name\" where name=\"app_name\""
|
||||
export MYSQL_PWD="$drs_pass"
|
||||
mysql -u"$drs_user" $new_db_name -e "update config set value=\"$new_inst_name\",defaultvalue=\"$new_inst_name\" where name=\"app_name\""
|
||||
|
||||
# Create install path
|
||||
echo "Creating installation directory . . ."
|
||||
@@ -219,8 +228,21 @@ else
|
||||
cp -Rv distfiles/* $install_path
|
||||
|
||||
# set ownership
|
||||
echo "In order to set the ownership correctly, we need to know the user and"
|
||||
echo "group that the webserver expects its files to be owned by. This is"
|
||||
echo "usually not the root account. Refer to the ownership of other files in"
|
||||
echo "your webserver's document tree to see what this should be."
|
||||
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
|
||||
if [ "$httpd_user_group" = "" ]
|
||||
then
|
||||
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
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -63,7 +63,7 @@ CREATE TABLE `config` (
|
||||
|
||||
LOCK TABLES `config` WRITE;
|
||||
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
|
||||
INSERT INTO `config` VALUES (1,'drs_version','1.1.0','1.1.0'),(5,'app_name','OpenDRS - Discrepancy Reporting System','OpenDRS Discrepancy Reporting System'),(6,'banner','1','1'),(7,'background_color','0B3144','0B3144'),(8,'p_background_color','FFFFFF','FFFFFF'),(11,'menubg_color','000000','000000'),(12,'p_menubg_color','FFFFFF','FFFFFF'),(13,'text_color','FFFFFF','FFFFFF'),(14,'p_text_color','000000','000000'),(15,'link_color','79EFEA','79EFEA'),(16,'p_link_color','000000','000000'),(17,'vlink_color','79EFEA','79EFEA'),(18,'p_vlink_color','000000','000000'),(19,'heading_color','5AE2B3','5AE2B3'),(20,'p_heading_color','000000','000000'),(21,'footer_message','Please report bugs to Rod Wright (software@rodsplace.net)','Please report bugs to Rod Wright (software@rodsplace.net)'),(26,'unix_server_session_dir','/tmp/opendrs/opendrs/sessions','/tmp/opendrs/opendrs/sessions'),(27,'win_server_session_dir','c:\\Windows\\Temp\\opendrs\\opendrs\\sessions','c:\\Windows\\Temp\\opendrs\\opendrs\\sessions'),(28,'session_ttl_days','30','30'),(29,'period_eff_help_txt','If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.','If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.');
|
||||
INSERT INTO `config` VALUES (1,'drs_version','1.1.1','1.1.1'),(5,'app_name','OpenDRS - Discrepancy Reporting System','OpenDRS Discrepancy Reporting System'),(6,'banner','1','1'),(7,'background_color','0B3144','0B3144'),(8,'p_background_color','FFFFFF','FFFFFF'),(11,'menubg_color','000000','000000'),(12,'p_menubg_color','FFFFFF','FFFFFF'),(13,'text_color','FFFFFF','FFFFFF'),(14,'p_text_color','000000','000000'),(15,'link_color','79EFEA','79EFEA'),(16,'p_link_color','000000','000000'),(17,'vlink_color','79EFEA','79EFEA'),(18,'p_vlink_color','000000','000000'),(19,'heading_color','5AE2B3','5AE2B3'),(20,'p_heading_color','000000','000000'),(21,'footer_message','Please report bugs to Rod Wright (software@rodsplace.net)','Please report bugs to Rod Wright (software@rodsplace.net)'),(26,'unix_server_session_dir','/tmp/opendrs/opendrs/sessions','/tmp/opendrs/opendrs/sessions'),(27,'win_server_session_dir','c:\\Windows\\Temp\\opendrs\\opendrs\\sessions','c:\\Windows\\Temp\\opendrs\\opendrs\\sessions'),(28,'session_ttl_days','30','30'),(29,'period_eff_help_txt','If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.','If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.');
|
||||
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@@ -1,22 +1,36 @@
|
||||
# opendrs-update.sql
|
||||
-- opendrs-update.sql
|
||||
|
||||
# ---------- version 1.1.0 -------------
|
||||
# Update version number
|
||||
update config set name="drs_version" where name="mts_version";
|
||||
update config set value="1.1.0",defaultvalue="1.1.0" where name="drs_version";
|
||||
-- ---------- version 1.1.0 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET name="drs_version" WHERE name="mts_version";
|
||||
UPDATE config SET value="1.1.0",defaultvalue="1.1.0" WHERE name="drs_version";
|
||||
|
||||
# Add period_eff_help_txt to config table
|
||||
insert into config(name,value,defaultvalue)
|
||||
select * from
|
||||
(select 'period_eff_help_txt',
|
||||
'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' as wval,
|
||||
'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' as dval
|
||||
-- Add period_eff_help_txt to config table
|
||||
INSERT INTO config(name,value,defaultvalue)
|
||||
SELECT * FROM
|
||||
(SELECT 'period_eff_help_txt',
|
||||
'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' AS wval,
|
||||
'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' AS dval
|
||||
)
|
||||
as tmp
|
||||
where not exists
|
||||
AS tmp
|
||||
WHERE NOT EXISTS
|
||||
(
|
||||
select name from config where name = 'period_eff_help_txt'
|
||||
) limit 1
|
||||
SELECT name FROM config WHERE name = 'period_eff_help_txt'
|
||||
) LIMIT 1
|
||||
;
|
||||
# ---------------------------------------
|
||||
-- --------------------------------------
|
||||
|
||||
-- ---------- version 1.1.1 -------------
|
||||
-- Update version number
|
||||
UPDATE config SET value="1.1.1",defaultvalue="1.1.1" WHERE name="drs_version";
|
||||
|
||||
-- Rename the trainers table to devices
|
||||
RENAME TABLE trainers TO devices;
|
||||
|
||||
-- Update default app name
|
||||
UPDATE config SET defaultvalue="OpenDRS Discrepancy Reporting System" WHERE name="app_name";
|
||||
|
||||
-- Update default session directories
|
||||
UPDATE config SET defaultvalue="/tmp/opendrs/opendrs/sessions" WHERE name="unix_server_session_dir";
|
||||
UPDATE config SET defaultvalue="c:\Windows\Temp\opendrs\opendrs\sessions" WHERE name="win_server_session_dir";
|
||||
-- --------------------------------------
|
||||
|
||||