#!/usr/bin/bash
# -*- sh; sh-shell: bash; -*-

# Script to remove all linphone contacts

# Script Requires: bash tar xz sed sqlite3 regexp.so
# regexp.so for linux x86 is inside archive https://github.com/nalgeon/sqlean/releases/download/0.21.8/sqlean-linux-x86.zip
# https://hakanu.net/sqlite/2021/04/10/how-to-achieve-regular-expression-based-replace-in-sqlite-regex/
# https://github.com/nalgeon/sqlean/blob/main/docs/regexp.md

# Tested with linphone v5.2.0

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $SCRIPT_DIR/linphone-contacts-library

echo 'To remove all linphone contacts type the following command in terminal:'
echo
echo "    source $SCRIPT_DIR/linphone-contacts-library"
echo
sleep 1
echo 'REMINDER: Create a backup of your contacts !'
#sleep 1
echo '============================================'
echo 'Type the following command in terminal to create a backup:'
echo
echo '    linphone-contacts-export-archive'
echo
#sleep 1
echo 'You may now issue the dangerous command:'
echo
echo '    linphone-contacts-remove-all'
echo
echo 'WARNING! All your linphone contacts will be REMOVED !'
#sleep 1
echo '====================================================='

exit 0
