Install functions

This commit is contained in:
Bob Mottram 2016-07-05 08:22:33 +01:00
parent cd0a878149
commit 09bc799226
6 changed files with 37 additions and 37 deletions

View File

@ -37,7 +37,7 @@ function backup_babel {
}
function remove_babel {
if ! grep -Fxq "mesh_babel" $COMPLETION_FILE; then
if ! grep -Fxq "install_babel" $COMPLETION_FILE; then
return
fi
@ -51,7 +51,7 @@ function remove_babel {
function_check save_firewall_settings
save_firewall_settings
sed -i '/mesh_babel/d' $COMPLETION_FILE
sed -i '/install_babel/d' $COMPLETION_FILE
sed -i '/configure_firewall_for_babel/d' $COMPLETION_FILE
}
@ -70,8 +70,8 @@ function configure_firewall_for_babel {
echo 'configure_firewall_for_babel' >> $COMPLETION_FILE
}
function mesh_babel {
if grep -Fxq "mesh_babel" $COMPLETION_FILE; then
function install_babel {
if grep -Fxq "install_babel" $COMPLETION_FILE; then
return
fi
if [[ $ENABLE_BABEL != "yes" ]]; then
@ -86,7 +86,7 @@ function mesh_babel {
function_check configure_firewall_for_babel
configure_firewall_for_babel
echo 'mesh_babel' >> $COMPLETION_FILE
echo 'install_babel' >> $COMPLETION_FILE
}
# NOTE: deliberately there is no "exit 0"

View File

@ -50,7 +50,7 @@ function backup_batman {
}
function remove_batman {
if ! grep -Fxq "mesh_batman" $COMPLETION_FILE; then
if ! grep -Fxq "install_batman" $COMPLETION_FILE; then
return
fi
@ -59,12 +59,12 @@ function remove_batman {
echo $'Failed to remove batman'
exit 79353
fi
sed -i '/mesh_batman/d' $COMPLETION_FILE
sed -i '/install_batman/d' $COMPLETION_FILE
sed -i '/configure_firewall_for_batman/d' $COMPLETION_FILE
}
function mesh_batman {
if grep -Fxq "mesh_batman" $COMPLETION_FILE; then
function install_batman {
if grep -Fxq "install_batman" $COMPLETION_FILE; then
return
fi
if [[ $ENABLE_BATMAN != "yes" ]]; then
@ -91,7 +91,7 @@ function mesh_batman {
function_check configure_firewall_for_batman
configure_firewall_for_batman
echo 'mesh_batman' >> $COMPLETION_FILE
echo 'install_batman' >> $COMPLETION_FILE
}
# NOTE: deliberately no exit 0

View File

@ -112,7 +112,7 @@ function backup_cjdns {
}
function remove_cjdns {
if ! grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then
if ! grep -Fxq "install_cjdns" $COMPLETION_FILE; then
return
fi
service cjdns stop
@ -124,12 +124,12 @@ function remove_cjdns {
save_firewall_settings
rm -rf /etc/cjdns
sed -i '/mesh_cjdns/d' $COMPLETION_FILE
sed -i '/install_cjdns/d' $COMPLETION_FILE
sed -i '/cjdns /d' $COMPLETION_FILE
sed -i '/configure_firewall_for_cjdns/d' $COMPLETION_FILE
}
function mesh_cjdns {
function install_cjdns {
if [[ $ENABLE_CJDNS != "yes" ]]; then
return
fi
@ -138,7 +138,7 @@ function mesh_cjdns {
function_check set_repo_commit
set_repo_commit /etc/cjdns "cjdns commit" "$CJDNS_COMMIT" $CJDNS_REPO
if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then
if grep -Fxq "install_cjdns" $COMPLETION_FILE; then
return
fi
@ -418,18 +418,18 @@ function mesh_cjdns {
function_check configure_firewall_for_cjdns
configure_firewall_for_cjdns
echo 'mesh_cjdns' >> $COMPLETION_FILE
echo 'install_cjdns' >> $COMPLETION_FILE
}
function mesh_cjdns_tools {
if grep -Fxq "mesh_cjdns_tools" $COMPLETION_FILE; then
function install_cjdns_tools {
if grep -Fxq "install_cjdns_tools" $COMPLETION_FILE; then
return
fi
if [[ $ENABLE_CJDNS != "yes" ]]; then
return
fi
if [ ! -d /etc/cjdns ]; then
mesh_cjdns
install_cjdns
fi
function_check select_go_version
@ -477,7 +477,7 @@ function mesh_cjdns_tools {
# initialise from the cjdns config
/usr/bin/cjdcmd cjdnsadmin -file /etc/cjdns/cjdroute.conf
echo 'mesh_cjdns_tools' >> $COMPLETION_FILE
echo 'install_cjdns_tools' >> $COMPLETION_FILE
}
# NOTE: deliberately no exit 0

View File

@ -531,7 +531,7 @@ function mesh_avahi {
chmod +x $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
}
function mesh_batman {
function install_batman {
chroot "$rootdir" apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
chroot "$rootdir" apt-get -y install python-dev libevent-dev ebtables python-pip git
chroot "$rootdir" apt-get -y install wireless-tools rfkill
@ -1111,7 +1111,7 @@ initialise_mesh() {
mesh_firewall
mesh_avahi
mesh_batman
install_batman
mesh_tox_node
mesh_tox_avahi
mesh_tox_client

View File

@ -99,7 +99,7 @@ function show_help {
}
function mesh_babel {
function install_babel {
$CHROOT_PREFIX apt-get -y install babeld
babel_script=${rootdir}/var/lib/babel
@ -180,7 +180,7 @@ function mesh_babel {
$CHROOT_PREFIX systemctl enable babel
}
function mesh_babel_remove {
function install_babel_remove {
$CHROOT_PREFIX systemctl stop babel
$CHROOT_PREFIX apt-get -y remove --purge babeld
rm ${rootdir}/var/lib/babel
@ -227,7 +227,7 @@ function mesh_avahi {
chmod +x $rootdir/usr/bin/$WATCHDOG_SCRIPT_NAME
}
function mesh_babel_client {
function install_babel_client {
# TODO to be fixed
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
@ -333,13 +333,13 @@ function mesh_babel_client {
sudo mv $babel_script ${rootdir}/usr/bin/babel
}
function mesh_batman_remove {
function install_batman_remove {
systemctl stop batman
rm $rootdir/var/lib/batman
rm $rootdir/etc/systemd/system/batman.service
}
function mesh_batman {
function install_batman {
$CHROOT_PREFIX apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
$CHROOT_PREFIX apt-get -y install python-dev libevent-dev ebtables python-pip git
$CHROOT_PREFIX apt-get -y install wireless-tools rfkill
@ -799,7 +799,7 @@ function mesh_zeronet {
$CHROOT_PREFIX systemctl enable zeronet.service
}
function mesh_batman_client {
function install_batman_client {
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
else
@ -1101,13 +1101,13 @@ done
if [[ $FN == 'babel' ]]; then
if [[ $REMOVE != 'yes' ]]; then
mesh_babel
install_babel
else
mesh_babel_remove
install_babel_remove
fi
fi
if [[ $FN == 'babel_client' ]]; then
mesh_babel_client
install_babel_client
fi
if [[ $FN == 'avahi' ]]; then
mesh_avahi
@ -1117,13 +1117,13 @@ if [[ $FN == 'firewall' ]]; then
fi
if [[ $FN == 'batman' ]]; then
if [[ $REMOVE != 'yes' ]]; then
mesh_batman
install_batman
else
mesh_batman_remove
install_batman_remove
fi
fi
if [[ $FN == 'batman_client' ]]; then
mesh_batman_client
install_batman_client
fi
if [[ $FN == 'tox_node' ]]; then
if [[ $REMOVE != 'yes' ]]; then

View File

@ -291,10 +291,10 @@ function setup_utils {
}
function setup_mesh {
mesh_cjdns
mesh_cjdns_tools
mesh_batman
mesh_babel
install_cjdns
install_cjdns_tools
install_batman
install_babel
}
function setup_email {