summarylogtreecommitdiffstats
path: root/notion-enhancer
blob: 17a84395a0d5e8d1d1167778c049aebdbab4713d (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
#colored warning
warn() {
    printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
}

all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"

post_install() {
    echo "Applying notion-enhancer automatically..."
    warn "If you want to use the enhancer without running sudo (recommended by the developer), then run \n chmod -R a+wr /usr/lib/node_modules/notion-enhancer/ /opt/notion-app/app /usr/share/applications/notion-app.desktop /usr/bin/notion-app \n However, be wary of the security risks posed by such patch."
	notion-enhancer apply -y
}

post_upgrade() {
    if [[ "$(notion-enhancer check)" == *" not "* ]]; then
        echo "Notion-enhancer is not applied, skipping"
    else
        echo "Reapplying notion-enhancer"
        notion-enhancer remove -n # don't delete the data
        notion-enhancer apply -y # yes, overwrite
        warn "If you want to use the enhancer without running sudo (recommended by the developer), then run: \n chmod -R a+wr /usr/lib/node_modules/notion-enhancer/ /opt/notion-app/app /usr/share/applications/notion-app.desktop /usr/bin/notion-app \n However, be wary of the security risks posed by such patch."
    fi
}

pre_remove() {
    echo "Disabling notion-enhancer..."
    warn "The data folder will NOT be deleted"
	notion-enhancer remove -n
}