Upgrade from previous
This commit is contained in:
parent
2a40c5565c
commit
5869c445db
436
src/freedombone
436
src/freedombone
|
@ -37,7 +37,7 @@ export TEXTDOMAINDIR="/usr/share/locale"
|
||||||
|
|
||||||
PROJECT_INSTALL_DIR=/usr/local/bin
|
PROJECT_INSTALL_DIR=/usr/local/bin
|
||||||
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
if [ -f /usr/bin/${PROJECT_NAME} ]; then
|
||||||
PROJECT_INSTALL_DIR=/usr/bin
|
PROJECT_INSTALL_DIR=/usr/bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
|
source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
|
||||||
|
@ -45,242 +45,242 @@ source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars
|
||||||
command_options=$1
|
command_options=$1
|
||||||
|
|
||||||
if [[ $command_options == "menuconfig-full" ]]; then
|
if [[ $command_options == "menuconfig-full" ]]; then
|
||||||
MINIMAL_INSTALL="no"
|
MINIMAL_INSTALL="no"
|
||||||
command_options="menuconfig"
|
command_options="menuconfig"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $command_options == "menuconfig-onion" ]]; then
|
if [[ $command_options == "menuconfig-onion" ]]; then
|
||||||
MINIMAL_INSTALL="yes"
|
MINIMAL_INSTALL="yes"
|
||||||
ONION_ONLY="yes"
|
ONION_ONLY="yes"
|
||||||
command_options="menuconfig"
|
command_options="menuconfig"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $command_options == "menuconfig" ]]; then
|
if [[ $command_options == "menuconfig" ]]; then
|
||||||
interactive_configuration
|
interactive_configuration
|
||||||
else
|
else
|
||||||
while [[ $# > 1 ]]
|
while [[ $# > 1 ]]
|
||||||
do
|
do
|
||||||
key="$1"
|
key="$1"
|
||||||
|
|
||||||
case $key in
|
case $key in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
show_help
|
show_help
|
||||||
;;
|
;;
|
||||||
# load a configuration file
|
# load a configuration file
|
||||||
-c|--config)
|
-c|--config)
|
||||||
shift
|
shift
|
||||||
CONFIGURATION_FILE="$1"
|
CONFIGURATION_FILE="$1"
|
||||||
INSTALLING_FROM_CONFIGURATION_FILE="yes"
|
INSTALLING_FROM_CONFIGURATION_FILE="yes"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
# username within /home
|
# username within /home
|
||||||
-u|--user)
|
-u|--user)
|
||||||
shift
|
shift
|
||||||
MY_USERNAME="$1"
|
MY_USERNAME="$1"
|
||||||
;;
|
;;
|
||||||
# microblog domain name
|
# microblog domain name
|
||||||
--microblogdomain)
|
--microblogdomain)
|
||||||
shift
|
shift
|
||||||
MICROBLOG_DOMAIN_NAME="$1"
|
MICROBLOG_DOMAIN_NAME="$1"
|
||||||
;;
|
;;
|
||||||
# wiki domain name
|
# wiki domain name
|
||||||
--wikidomain)
|
--wikidomain)
|
||||||
shift
|
shift
|
||||||
WIKI_DOMAIN_NAME="$1"
|
WIKI_DOMAIN_NAME="$1"
|
||||||
;;
|
;;
|
||||||
# blog domain name
|
# blog domain name
|
||||||
--blogdomain)
|
--blogdomain)
|
||||||
shift
|
shift
|
||||||
FULLBLOG_DOMAIN_NAME="$1"
|
FULLBLOG_DOMAIN_NAME="$1"
|
||||||
;;
|
;;
|
||||||
# hubzilla domain name
|
# hubzilla domain name
|
||||||
--hubzilladomain)
|
--hubzilladomain)
|
||||||
shift
|
shift
|
||||||
HUBZILLA_DOMAIN_NAME="$1"
|
HUBZILLA_DOMAIN_NAME="$1"
|
||||||
;;
|
;;
|
||||||
# git hosting domain name
|
# git hosting domain name
|
||||||
--gitdomain)
|
--gitdomain)
|
||||||
shift
|
shift
|
||||||
GIT_DOMAIN_NAME="$1"
|
GIT_DOMAIN_NAME="$1"
|
||||||
;;
|
;;
|
||||||
# default domain name
|
# default domain name
|
||||||
-d|--domain)
|
-d|--domain)
|
||||||
shift
|
shift
|
||||||
DEFAULT_DOMAIN_NAME="$1"
|
DEFAULT_DOMAIN_NAME="$1"
|
||||||
;;
|
;;
|
||||||
# The type of system
|
# The type of system
|
||||||
-s|--system)
|
-s|--system)
|
||||||
shift
|
shift
|
||||||
SYSTEM_TYPE="$1"
|
SYSTEM_TYPE="$1"
|
||||||
;;
|
;;
|
||||||
# The dynamic DNS provider
|
# The dynamic DNS provider
|
||||||
--ddns)
|
--ddns)
|
||||||
shift
|
shift
|
||||||
DDNS_PROVIDER="$1"
|
DDNS_PROVIDER="$1"
|
||||||
;;
|
;;
|
||||||
# Username for the synamic DNS provider
|
# Username for the synamic DNS provider
|
||||||
--ddnsuser)
|
--ddnsuser)
|
||||||
shift
|
shift
|
||||||
DDNS_USERNAME="$1"
|
DDNS_USERNAME="$1"
|
||||||
;;
|
;;
|
||||||
# Password for the synamic DNS provider
|
# Password for the synamic DNS provider
|
||||||
--ddnspass)
|
--ddnspass)
|
||||||
shift
|
shift
|
||||||
DDNS_PASSWORD="$1"
|
DDNS_PASSWORD="$1"
|
||||||
;;
|
;;
|
||||||
# Whether this installation is on a Beaglebone Black
|
# Whether this installation is on a Beaglebone Black
|
||||||
--bbb)
|
--bbb)
|
||||||
INSTALLING_ON_BBB="yes"
|
INSTALLING_ON_BBB="yes"
|
||||||
;;
|
;;
|
||||||
# Domain name to use as a TLS time source
|
# Domain name to use as a TLS time source
|
||||||
-t|--time)
|
-t|--time)
|
||||||
shift
|
shift
|
||||||
TLS_TIME_SOURCE1="$1"
|
TLS_TIME_SOURCE1="$1"
|
||||||
;;
|
;;
|
||||||
# Static IP address for the system
|
# Static IP address for the system
|
||||||
--ip)
|
--ip)
|
||||||
shift
|
shift
|
||||||
LOCAL_NETWORK_STATIC_IP_ADDRESS=$1
|
LOCAL_NETWORK_STATIC_IP_ADDRESS=$1
|
||||||
;;
|
;;
|
||||||
# IP address for the internet router
|
# IP address for the internet router
|
||||||
--iprouter)
|
--iprouter)
|
||||||
shift
|
shift
|
||||||
ROUTER_IP_ADDRESS=$1
|
ROUTER_IP_ADDRESS=$1
|
||||||
;;
|
;;
|
||||||
# ssh port
|
# ssh port
|
||||||
--ssh)
|
--ssh)
|
||||||
shift
|
shift
|
||||||
SSH_PORT=$1
|
SSH_PORT=$1
|
||||||
;;
|
;;
|
||||||
# public mailing list name
|
# public mailing list name
|
||||||
--list)
|
--list)
|
||||||
shift
|
shift
|
||||||
PUBLIC_MAILING_LIST="$1"
|
PUBLIC_MAILING_LIST="$1"
|
||||||
;;
|
;;
|
||||||
# Number of CPU cores
|
# Number of CPU cores
|
||||||
--cores)
|
--cores)
|
||||||
shift
|
shift
|
||||||
CPU_CORES=$1
|
CPU_CORES=$1
|
||||||
;;
|
;;
|
||||||
# my name
|
# my name
|
||||||
--name)
|
--name)
|
||||||
shift
|
shift
|
||||||
MY_NAME="$1"
|
MY_NAME="$1"
|
||||||
;;
|
;;
|
||||||
# my email address
|
# my email address
|
||||||
--email)
|
--email)
|
||||||
shift
|
shift
|
||||||
MY_EMAIL_ADDRESS="$1"
|
MY_EMAIL_ADDRESS="$1"
|
||||||
;;
|
;;
|
||||||
# USB drive
|
# USB drive
|
||||||
--usb)
|
--usb)
|
||||||
shift
|
shift
|
||||||
USB_DRIVE=$1
|
USB_DRIVE=$1
|
||||||
;;
|
;;
|
||||||
# Enable CJDNS
|
# Enable CJDNS
|
||||||
--cjdns)
|
--cjdns)
|
||||||
shift
|
shift
|
||||||
ENABLE_CJDNS="yes"
|
ENABLE_CJDNS="yes"
|
||||||
;;
|
;;
|
||||||
# Enable B.A.T.M.A.N
|
# Enable B.A.T.M.A.N
|
||||||
--batman)
|
--batman)
|
||||||
shift
|
shift
|
||||||
ENABLE_BATMAN="yes"
|
ENABLE_BATMAN="yes"
|
||||||
;;
|
;;
|
||||||
# Enable Babel
|
# Enable Babel
|
||||||
--babel)
|
--babel)
|
||||||
shift
|
shift
|
||||||
ENABLE_BABEL="yes"
|
ENABLE_BABEL="yes"
|
||||||
;;
|
;;
|
||||||
# VoIP server password
|
# VoIP server password
|
||||||
--vpass)
|
--vpass)
|
||||||
shift
|
shift
|
||||||
VOIP_SERVER_PASSWORD=$1
|
VOIP_SERVER_PASSWORD=$1
|
||||||
;;
|
;;
|
||||||
# VoIP server port
|
# VoIP server port
|
||||||
--vport)
|
--vport)
|
||||||
shift
|
shift
|
||||||
VOIP_PORT=$1
|
VOIP_PORT=$1
|
||||||
;;
|
;;
|
||||||
# DNS Nameserver 1
|
# DNS Nameserver 1
|
||||||
--ns1)
|
--ns1)
|
||||||
shift
|
shift
|
||||||
NAMESERVER1=$1
|
NAMESERVER1=$1
|
||||||
;;
|
;;
|
||||||
# DNS Nameserver 2
|
# DNS Nameserver 2
|
||||||
--ns2)
|
--ns2)
|
||||||
shift
|
shift
|
||||||
NAMESERVER2=$1
|
NAMESERVER2=$1
|
||||||
;;
|
;;
|
||||||
# Debian repository
|
# Debian repository
|
||||||
--repo)
|
--repo)
|
||||||
shift
|
shift
|
||||||
DEBIAN_REPO=$1
|
DEBIAN_REPO=$1
|
||||||
;;
|
;;
|
||||||
# minimal install
|
# minimal install
|
||||||
--minimal)
|
--minimal)
|
||||||
shift
|
shift
|
||||||
MINIMAL_INSTALL=$1
|
MINIMAL_INSTALL=$1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function parse_args {
|
function parse_args {
|
||||||
if [[ $NO_OF_ARGS == 0 ]]; then
|
if [[ $NO_OF_ARGS == 0 ]]; then
|
||||||
echo 'no_of_args = 0'
|
echo 'no_of_args = 0'
|
||||||
show_help
|
show_help
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d /home/$MY_USERNAME ]; then
|
if [ ! -d /home/$MY_USERNAME ]; then
|
||||||
echo $"There is no user '$MY_USERNAME' on the system. Use 'adduser $MY_USERNAME' to create the user."
|
echo $"There is no user '$MY_USERNAME' on the system. Use 'adduser $MY_USERNAME' to create the user."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ ! "$DEFAULT_DOMAIN_NAME" ]; then
|
if [ ! "$DEFAULT_DOMAIN_NAME" ]; then
|
||||||
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
|
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
|
||||||
echo 'No default domain specified'
|
echo 'No default domain specified'
|
||||||
show_help
|
show_help
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! $MY_USERNAME ]; then
|
if [ ! $MY_USERNAME ]; then
|
||||||
echo 'No username specified'
|
echo 'No username specified'
|
||||||
show_help
|
show_help
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
|
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
|
||||||
if [[ $ONION_ONLY == "no" ]]; then
|
if [[ $ONION_ONLY == "no" ]]; then
|
||||||
if [ ! $DDNS_USERNAME ]; then
|
if [ ! $DDNS_USERNAME ]; then
|
||||||
echo $'Please provide the username for your dynamic DNS provider with the --ddnsuser option'
|
echo $'Please provide the username for your dynamic DNS provider with the --ddnsuser option'
|
||||||
exit 7823
|
exit 7823
|
||||||
fi
|
fi
|
||||||
if [ ! $DDNS_PASSWORD ]; then
|
if [ ! $DDNS_PASSWORD ]; then
|
||||||
echo $'Please provide the password for your dynamic DNS provider with the --ddnspass option'
|
echo $'Please provide the password for your dynamic DNS provider with the --ddnspass option'
|
||||||
exit 6382
|
exit 6382
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! $SYSTEM_TYPE ]; then
|
if [ ! $SYSTEM_TYPE ]; then
|
||||||
SYSTEM_TYPE=$VARIANT_FULL
|
SYSTEM_TYPE=$VARIANT_FULL
|
||||||
fi
|
fi
|
||||||
if [[ $SYSTEM_TYPE != $VARIANT_WRITER && $SYSTEM_TYPE != $VARIANT_CLOUD && $SYSTEM_TYPE != $VARIANT_CHAT && $SYSTEM_TYPE != $VARIANT_MAILBOX && $SYSTEM_TYPE != $VARIANT_NONMAILBOX && $SYSTEM_TYPE != $VARIANT_SOCIAL && $SYSTEM_TYPE != $VARIANT_MEDIA && $SYSTEM_TYPE != $VARIANT_DEVELOPER && $SYSTEM_TYPE != $VARIANT_MESH && $SYSTEM_TYPE != $VARIANT_FULL ]]; then
|
if [[ $SYSTEM_TYPE != $VARIANT_WRITER && $SYSTEM_TYPE != $VARIANT_CLOUD && $SYSTEM_TYPE != $VARIANT_CHAT && $SYSTEM_TYPE != $VARIANT_MAILBOX && $SYSTEM_TYPE != $VARIANT_NONMAILBOX && $SYSTEM_TYPE != $VARIANT_SOCIAL && $SYSTEM_TYPE != $VARIANT_MEDIA && $SYSTEM_TYPE != $VARIANT_DEVELOPER && $SYSTEM_TYPE != $VARIANT_MESH && $SYSTEM_TYPE != $VARIANT_FULL ]]; then
|
||||||
echo $"'$SYSTEM_TYPE' is an unrecognised ${PROJECT_NAME} variant."
|
echo $"'$SYSTEM_TYPE' is an unrecognised ${PROJECT_NAME} variant."
|
||||||
exit 30
|
exit 30
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# run some initial tests
|
# run some initial tests
|
||||||
${PROJECT_NAME}-tests
|
${PROJECT_NAME}-tests
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 768252
|
exit 768252
|
||||||
fi
|
fi
|
||||||
|
|
||||||
upgrade_installation
|
upgrade_installation_from_previous_versions
|
||||||
setup_utils
|
setup_utils
|
||||||
setup_email
|
setup_email
|
||||||
setup_web
|
setup_web
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
VARIANTS='mesh'
|
VARIANTS=''
|
||||||
|
|
||||||
TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs"
|
TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs"
|
||||||
TAHOELAFS_COMMIT='30b421d48b3d1dae2ef507bf27a1f3816300cd92'
|
TAHOELAFS_COMMIT='30b421d48b3d1dae2ef507bf27a1f3816300cd92'
|
||||||
|
|
|
@ -47,11 +47,11 @@ function create_upgrade_script {
|
||||||
echo 'create_upgrade_script' >> $COMPLETION_FILE
|
echo 'create_upgrade_script' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_installation {
|
function upgrade_installation_from_previous_versions {
|
||||||
if [ ! -f $COMPLETION_FILE ]; then
|
if [ ! -f $COMPLETION_FILE ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if grep -Fxq "upgrade_installation" $COMPLETION_FILE; then
|
if grep -Fxq "upgrade_installation_from_previous_versions" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ function upgrade_installation {
|
||||||
rm /usr/local/bin/zeronetavahi
|
rm /usr/local/bin/zeronetavahi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'upgrade_installation' >> $COMPLETION_FILE
|
echo 'upgrade_installation_from_previous_versions' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
# NOTE: deliberately no exit 0
|
# NOTE: deliberately no exit 0
|
||||||
|
|
Loading…
Reference in New Issue