From 812fb74cd014b6ef30f39fae50b596a5593a6440 Mon Sep 17 00:00:00 2001 From: Ziru Zhu Date: Tue, 19 Dec 2017 06:59:53 -0800 Subject: [PATCH] Initial Commit --- README.md | 17 +++++++++++++++++ data/placeholder.txt | 0 export.sh | 9 +++++++++ import.sh | 12 ++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 README.md create mode 100644 data/placeholder.txt create mode 100755 export.sh create mode 100755 import.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..d2a0623 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +### Import/Export Google Chrome's custom search engines + +**_Quit Google Chrome before exporting/importing custom search engines._** + +To Export from one machine: +``` +./export.sh +``` + +To Import on a different machine: +``` +./import.sh +``` + +Note: +- The import script will drop all existent entries before inserting saved entries. +- This can be used to wipe search engines which are automatically added by many web sites. diff --git a/data/placeholder.txt b/data/placeholder.txt new file mode 100644 index 0000000..e69de29 diff --git a/export.sh b/export.sh new file mode 100755 index 0000000..077fc33 --- /dev/null +++ b/export.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +CHROME_DATA_PATH="${HOME}/Library/Application Support/Google/Chrome/Default" +SEARCH_ENGINE_DB="${CHROME_DATA_PATH}/Web Data" + +OUTPUT_FILE=./data/keywords.sql + +echo "[INFO] Backup existent keywords table into: ${OUTPUT_FILE}" +sqlite3 "${SEARCH_ENGINE_DB}" ".dump keywords" > ${OUTPUT_FILE} diff --git a/import.sh b/import.sh new file mode 100755 index 0000000..4213f40 --- /dev/null +++ b/import.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +CHROME_DATA_PATH="${HOME}/Library/Application Support/Google/Chrome/Default" +SEARCH_ENGINE_DB="${CHROME_DATA_PATH}/Web Data" + +INPUT_FILE=./data/keywords.sql + +echo "[INFO] Drop existent keywords table if any" +sqlite3 "${SEARCH_ENGINE_DB}" "DROP TABLE keywords" + +echo "[INFO] Import custom search engine entries into Chrome Web Data database" +sqlite3 "${SEARCH_ENGINE_DB}" ".read ${INPUT_FILE}"