summaryrefslogtreecommitdiff
path: root/.install/aetherfox
blob: 722560c7e7b80e385211a9b6d9213d77aa8117e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -euo pipefail

FIREFOX_DIR="${HOME}/.mozilla/firefox"
REPO_URL="https://github.com/QuixoticNapoleon/AetherFox"

if [[ ! -d "$FIREFOX_DIR" ]]; then
    echo "Firefox profile directory not found: $FIREFOX_DIR" >&2
    exit 1
fi

profile_dir=""

shopt -s nullglob
profiles=( "$FIREFOX_DIR"/*.default-release )
shopt -u nullglob

if (( ${#profiles[@]} == 0 )); then
    echo "No Firefox .default-release profile found in $FIREFOX_DIR" >&2
    exit 1
fi

profile_dir="${profiles[0]}"
chrome_dir="${profile_dir}/chrome"

mkdir -p "$chrome_dir"

if [[ -d "$chrome_dir/.git" ]]; then
    echo "Git repository already exists in: $chrome_dir"
    exit 0
fi

echo "No git repository found in: $chrome_dir"
echo "Removing existing contents..."

find "$chrome_dir" -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +

echo "Cloning AetherFox into: $chrome_dir"
git clone "$REPO_URL" "$chrome_dir"

echo "Done."