function to remove tripwire
This commit is contained in:
parent
ebd7f2522d
commit
c42e5eaa30
|
@ -28,6 +28,18 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
|
function remove_intrusion_detection {
|
||||||
|
if ! grep -Fxq "intrusion_detection" $COMPLETION_FILE; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
apt-get -y remove --purge tripwire
|
||||||
|
if [ -d /etc/tripwire ]; then
|
||||||
|
rm -rf /etc/tripwire
|
||||||
|
fi
|
||||||
|
rm /usr/bin/reset-tripwire
|
||||||
|
sed -i '/intrusion_detection/d' $COMPLETION_FILE
|
||||||
|
}
|
||||||
|
|
||||||
function intrusion_detection {
|
function intrusion_detection {
|
||||||
if grep -Fxq "intrusion_detection" $COMPLETION_FILE; then
|
if grep -Fxq "intrusion_detection" $COMPLETION_FILE; then
|
||||||
return
|
return
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -48,49 +48,49 @@ if [ -f /usr/bin/${PROJECT_NAME}-utils-git ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function read_repo_servers {
|
function read_repo_servers {
|
||||||
if [ -f $CONFIGURATION_FILE ]; then
|
if [ -f $CONFIGURATION_FILE ]; then
|
||||||
if grep -q "FRIENDS_MIRRORS_SERVER" $CONFIGURATION_FILE; then
|
if grep -q "FRIENDS_MIRRORS_SERVER" $CONFIGURATION_FILE; then
|
||||||
FRIENDS_MIRRORS_SERVER=$(grep "FRIENDS_MIRRORS_SERVER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
FRIENDS_MIRRORS_SERVER=$(grep "FRIENDS_MIRRORS_SERVER" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
if grep -q "FRIENDS_MIRRORS_SSH_PORT" $CONFIGURATION_FILE; then
|
if grep -q "FRIENDS_MIRRORS_SSH_PORT" $CONFIGURATION_FILE; then
|
||||||
FRIENDS_MIRRORS_SSH_PORT=$(grep "FRIENDS_MIRRORS_SSH_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
FRIENDS_MIRRORS_SSH_PORT=$(grep "FRIENDS_MIRRORS_SSH_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
if grep -q "MY_MIRRORS_PASSWORD" $CONFIGURATION_FILE; then
|
if grep -q "MY_MIRRORS_PASSWORD" $CONFIGURATION_FILE; then
|
||||||
MY_MIRRORS_PASSWORD=$(grep "MY_MIRRORS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
MY_MIRRORS_PASSWORD=$(grep "MY_MIRRORS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
if grep -q "FRIENDS_MIRRORS_PASSWORD" $CONFIGURATION_FILE; then
|
if grep -q "FRIENDS_MIRRORS_PASSWORD" $CONFIGURATION_FILE; then
|
||||||
FRIENDS_MIRRORS_PASSWORD=$(grep "FRIENDS_MIRRORS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
FRIENDS_MIRRORS_PASSWORD=$(grep "FRIENDS_MIRRORS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! $FRIENDS_MIRRORS_SERVER ]; then
|
if [ ! $FRIENDS_MIRRORS_SERVER ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ ${#FRIENDS_MIRRORS_SERVER} -lt 2 ]; then
|
if [ ${#FRIENDS_MIRRORS_SERVER} -lt 2 ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MAIN_COMMAND=/usr/local/bin/${PROJECT_NAME}
|
MAIN_COMMAND=/usr/local/bin/${PROJECT_NAME}
|
||||||
if [ ! -f $MAIN_COMMAND ]; then
|
if [ ! -f $MAIN_COMMAND ]; then
|
||||||
MAIN_COMMAND=/usr/bin/${PROJECT_NAME}
|
MAIN_COMMAND=/usr/bin/${PROJECT_NAME}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
REPOS=($(cat ${MAIN_COMMAND} | grep "_REPO=\"" | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
|
REPOS=($(cat ${MAIN_COMMAND} | grep "_REPO=\"" | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
|
||||||
|
|
||||||
for line in "${REPOS[@]}"
|
for line in "${REPOS[@]}"
|
||||||
do
|
do
|
||||||
repo_name=$(echo "$line" | awk -F '=' '{print $1}')
|
repo_name=$(echo "$line" | awk -F '=' '{print $1}')
|
||||||
mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}')
|
mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}')
|
||||||
friends_repo_url="ssh://mirrors@${FRIENDS_MIRRORS_SERVER}:${FRIENDS_MIRRORS_SSH_PORT}/home/mirrors/${mirrors_name}"
|
friends_repo_url="ssh://mirrors@${FRIENDS_MIRRORS_SERVER}:${FRIENDS_MIRRORS_SSH_PORT}/home/mirrors/${mirrors_name}"
|
||||||
${repo_name}="${friends_repo_url}"
|
${repo_name}="${friends_repo_url}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f $CONFIGURATION_FILE ]; then
|
if [ -f $CONFIGURATION_FILE ]; then
|
||||||
# read the location of the main project repo
|
# read the location of the main project repo
|
||||||
if grep -q "PROJECT_REPO" $CONFIGURATION_FILE; then
|
if grep -q "PROJECT_REPO" $CONFIGURATION_FILE; then
|
||||||
PROJECT_REPO=$(grep "PROJECT_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
PROJECT_REPO=$(grep "PROJECT_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
update-ca-certificates
|
update-ca-certificates
|
||||||
|
@ -99,29 +99,31 @@ read_repo_servers
|
||||||
${PROJECT_NAME}-mirrors
|
${PROJECT_NAME}-mirrors
|
||||||
|
|
||||||
if [ ! -d $PROJECT_DIR ]; then
|
if [ ! -d $PROJECT_DIR ]; then
|
||||||
git_clone $PROJECT_REPO $PROJECT_DIR
|
git_clone $PROJECT_REPO $PROJECT_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d $PROJECT_DIR ]; then
|
if [ -d $PROJECT_DIR ]; then
|
||||||
if [ -f $CONFIGURATION_FILE ]; then
|
if [ -f $CONFIGURATION_FILE ]; then
|
||||||
cd $PROJECT_DIR
|
cd $PROJECT_DIR
|
||||||
rm -rf $PROJECT_DIR/locale/*
|
rm -rf $PROJECT_DIR/locale/*
|
||||||
git_pull $PROJECT_REPO
|
git_pull $PROJECT_REPO
|
||||||
make install
|
make install
|
||||||
${PROJECT_NAME} -c $CONFIGURATION_FILE
|
${PROJECT_NAME} -c $CONFIGURATION_FILE
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove the original sipwitch daemon if it exists
|
# remove the original sipwitch daemon if it exists
|
||||||
if [ -f /etc/init.d/sipwitch ]; then
|
if [ -f /etc/init.d/sipwitch ]; then
|
||||||
rm -f /etc/init.d/sipwitch
|
rm -f /etc/init.d/sipwitch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update blog avatar
|
# update blog avatar
|
||||||
${PROJECT_NAME}-blog
|
${PROJECT_NAME}-blog
|
||||||
|
|
||||||
echo '
|
if [ -f /usr/bin/reset-tripwire ]; then
|
||||||
|
echo '
|
||||||
|
|
||||||
' | reset-tripwire
|
' | reset-tripwire
|
||||||
|
fi
|
||||||
|
|
||||||
# deliberately there is no 'exit 0' here
|
# deliberately there is no 'exit 0' here
|
||||||
|
|
Loading…
Reference in New Issue