Experimental control scripts

This commit is contained in:
Bob Mottram 2017-06-23 10:35:58 +01:00
parent 6932df7fdb
commit 8c20b15f6f
8 changed files with 71 additions and 13 deletions

View File

@ -27,7 +27,7 @@ install:
cp img/backgrounds/${APP}_*.png ${DESTDIR}${PREFIX}/share
cp img/avatars/* ${DESTDIR}/usr/share/${APP}/avatars
cp src/* ${DESTDIR}${PREFIX}/bin
cp src/${APP}-controlpanel ${DESTDIR}${PREFIX}/bin/control
# cp src/${APP}-controlpanel ${DESTDIR}${PREFIX}/bin/control
cp src/${APP}-mesh-batman ${DESTDIR}${PREFIX}/bin/batman
cp src/${APP}-backup-local ${DESTDIR}${PREFIX}/bin/backup
cp src/${APP}-backup-local ${DESTDIR}${PREFIX}/bin/backup2friends
@ -46,6 +46,7 @@ install:
chown -R root: /usr/share/${APP}
chmod -R +r /usr/share/${APP}
# bash -c "./translate install"
/usr/local/bin/${APP}-prepare-scripts
uninstall:
rm -f ${PREFIX}/share/${APP}_*.png
rm -f ${PREFIX}/share/man/man1/backup.1.gz
@ -61,6 +62,8 @@ uninstall:
rm -f ${PREFIX}/bin/restorefromfriend
rm -f ${PREFIX}/bin/batman
rm -rf /etc/${APP}
rm -f ${PREFIX}/bin/control
rm -f ${PREFIX}/bin/controluser
bash -c "./translate uninstall"
clean:
rm -f \#* \.#* debian/*.substvars debian/*.log src/*~

View File

@ -235,8 +235,8 @@ if [ -f /etc/nginx/.htpasswd ]; then
fi
# add user menu on ssh login
if ! grep -q 'control' /home/$ADD_USERNAME/.bashrc; then
echo 'control' >> /home/$ADD_USERNAME/.bashrc
if ! grep -q 'controluser' /home/$ADD_USERNAME/.bashrc; then
echo 'controluser' >> /home/$ADD_USERNAME/.bashrc
fi
${PROJECT_NAME}-pass -u $ADD_USERNAME -a login -p "$NEW_USER_PASSWORD"

View File

@ -322,6 +322,9 @@ function remove_ghost {
function ghost_create_config {
ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
function_check get_mariadb_password
get_mariadb_password
echo "var path = require('path')," > $ghost_config
echo ' config;' >> $ghost_config
echo '' >> $ghost_config

View File

@ -33,6 +33,13 @@ PROJECT_NAME='freedombone'
export TEXTDOMAIN=${PROJECT_NAME}-controlpanel
export TEXTDOMAINDIR="/usr/share/locale"
if [[ $USER != 'root' ]]; then
# show the user version of the control panel
#${PROJECT_NAME}-controlpanel-user
controluser
exit 0
fi
function please_wait {
local str width height length
@ -49,6 +56,8 @@ function please_wait {
please_wait
# Start including files
source /usr/local/bin/${PROJECT_NAME}-vars
UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
@ -63,6 +72,8 @@ do
source $f
done
# End including files
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
SELECTED_USERNAME=
SIP_CONFIGURATION_FILE=/etc/sipwitch.conf
@ -2146,12 +2157,6 @@ function menu_top_level {
done
}
if [[ $USER != 'root' ]]; then
# show the user version of the control panel
${PROJECT_NAME}-controlpanel-user
exit 0
fi
if [ ! -f $COMPLETION_FILE ]; then
echo $'This command should only be run on an installed Freedombone system'
exit 1

View File

@ -37,6 +37,8 @@ MY_EMAIL_ADDRESS=$USER@$HOSTNAME
GPG_ID=$(gpg --list-keys $MY_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//')
GPG_BACKUP_ID=$(gpg --list-keys "(backup key)" | sed -n '2p' | sed 's/^[ \t]*//')
# Start including files
UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
for f in $UTILS_FILES
do
@ -49,6 +51,8 @@ do
source $f
done
# End including files
function any_key {
echo ' '
read -n1 -r -p $"Press any key to continue..." key

43
src/freedombone-prepare-scripts Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# Prepares control scripts
#
# License
# =======
#
# Copyright (C) 2017 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PROJECT_NAME='freedombone'
cat /usr/local/bin/${PROJECT_NAME}-vars /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-* /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* > /tmp/includescripts
cat /tmp/includescripts /usr/local/bin/freedombone-controlpanel > /usr/local/bin/control
cat /tmp/includescripts /usr/local/bin/freedombone-controlpanel-user > /usr/local/bin/controluser
sed '/# Start including files/,/# End including files/d' /usr/local/bin/control
sed '/# Start including files/,/# End including files/d' /usr/local/bin/controluser
rm /tmp/includescripts
exit 0

View File

@ -63,8 +63,8 @@ $(get_ssh_server_key)
echo ''
# add user menu on ssh login
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
echo 'control' >> /home/$MY_USERNAME/.bashrc
if ! grep -q 'controluser' /home/$MY_USERNAME/.bashrc; then
echo 'controluser' >> /home/$MY_USERNAME/.bashrc
fi
if [ ! -f $IMAGE_PASSWORD_FILE ]; then
if [ -f /root/${PROJECT_NAME}-wifi.cfg ]; then

View File

@ -515,10 +515,10 @@ function install_command_line_browser {
# set the home page
if ! grep -q "WWW_HOME" /home/$MY_USERNAME/.bashrc; then
if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
if ! grep -q 'controluser' /home/$MY_USERNAME/.bashrc; then
echo "export WWW_HOME=$DEFAULT_SEARCH" >> /home/$MY_USERNAME/.bashrc
else
sed -i "/control/i export WWW_HOME=$DEFAULT_SEARCH" /home/$MY_USERNAME/.bashrc
sed -i "/controluser/i export WWW_HOME=$DEFAULT_SEARCH" /home/$MY_USERNAME/.bashrc
fi
fi