Add missing default hooks installation on first run
We also simplify some code. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
parent
7cf1dadf5f
commit
70820d5f16
1 changed files with 19 additions and 24 deletions
|
@ -73,36 +73,31 @@ daemonsneedingdbus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultconfig() {
|
defaultconfig() {
|
||||||
#this is only run on the very first start of sxmo
|
if [ ! -r "$2" ]; then
|
||||||
|
mkdir -p "$(dirname "$2")"
|
||||||
|
cp "$1" "$2"
|
||||||
|
chmod "$3" "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -p "$XDG_CONFIG_HOME/sxmo"
|
defaultconfigs() {
|
||||||
cp /usr/share/sxmo/appcfg/xinit_template "$XDG_CONFIG_HOME/sxmo/xinit"
|
[ -r "$XDG_CONFIG_HOME/sxmo/xinit" ] && return
|
||||||
chmod u+rx "$XDG_CONFIG_HOME/sxmo/xinit"
|
|
||||||
|
|
||||||
#Set some default hooks
|
defaultconfig /usr/share/sxmo/appcfg/xinit_template "$XDG_CONFIG_HOME/sxmo/xinit" 744
|
||||||
mkdir -p "$XDG_CONFIG_HOME/sxmo/hooks"
|
|
||||||
if [ ! -e "$XDG_CONFIG_HOME/sxmo/hooks/ring" ]; then
|
defaultconfig /usr/share/sxmo/default_hooks/discard "$XDG_CONFIG_HOME/sxmo/hooks/discard" 744
|
||||||
cp /usr/share/sxmo/default_hooks/ring "$XDG_CONFIG_HOME/sxmo/hooks/ring"
|
defaultconfig /usr/share/sxmo/default_hooks/missed_call "$XDG_CONFIG_HOME/sxmo/hooks/missed_call" 744
|
||||||
chmod u+rx "$XDG_CONFIG_HOME/sxmo/hooks/ring"
|
defaultconfig /usr/share/sxmo/default_hooks/mute_ring "$XDG_CONFIG_HOME/sxmo/hooks/mute_ring" 744
|
||||||
fi
|
defaultconfig /usr/share/sxmo/default_hooks/pickup "$XDG_CONFIG_HOME/sxmo/hooks/pickup" 744
|
||||||
if [ ! -e "$XDG_CONFIG_HOME/sxmo/hooks/sms" ]; then
|
defaultconfig /usr/share/sxmo/default_hooks/postwake "$XDG_CONFIG_HOME/sxmo/hooks/postwake" 744
|
||||||
cp /usr/share/sxmo/default_hooks/sms "$XDG_CONFIG_HOME/sxmo/hooks/sms"
|
defaultconfig /usr/share/sxmo/default_hooks/ring "$XDG_CONFIG_HOME/sxmo/hooks/ring" 744
|
||||||
chmod u+rx "$XDG_CONFIG_HOME/sxmo/hooks/sms"
|
defaultconfig /usr/share/sxmo/default_hooks/rtcwake "$XDG_CONFIG_HOME/sxmo/hooks/rtcwake" 744
|
||||||
fi
|
defaultconfig /usr/share/sxmo/default_hooks/sms "$XDG_CONFIG_HOME/sxmo/hooks/sms" 744
|
||||||
if [ ! -e "$XDG_CONFIG_HOME/sxmo/hooks/pickup" ]; then
|
|
||||||
cp /usr/share/sxmo/default_hooks/pickup "$XDG_CONFIG_HOME/sxmo/hooks/pickup"
|
|
||||||
chmod u+rx "$XDG_CONFIG_HOME/sxmo/hooks/pickup"
|
|
||||||
fi
|
|
||||||
if [ ! -e "$XDG_CONFIG_HOME/sxmo/hooks/missed_call" ]; then
|
|
||||||
cp /usr/share/sxmo/default_hooks/missed_call "$XDG_CONFIG_HOME/sxmo/hooks/missed_call"
|
|
||||||
chmod u+rx "$XDG_CONFIG_HOME/sxmo/hooks/missed_call"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
customxinit() {
|
customxinit() {
|
||||||
set -o allexport
|
set -o allexport
|
||||||
# shellcheck disable=SC1090
|
defaultconfigs
|
||||||
[ ! -e "$XDG_CONFIG_HOME/sxmo/xinit" ] && defaultconfig
|
|
||||||
|
|
||||||
# shellcheck disable=SC1090,SC1091
|
# shellcheck disable=SC1090,SC1091
|
||||||
. "$XDG_CONFIG_HOME/sxmo/xinit"
|
. "$XDG_CONFIG_HOME/sxmo/xinit"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue