Skip to content
Snippets Groups Projects
Commit b3355334 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

adapt to scandir@-66serv 0.3.1. Avoid to erase user change at .xinitrc and .xsession at backup time

parent e0a4d501
No related branches found
No related tags found
No related merge requests found
......@@ -7,11 +7,11 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then
unset f
fi
list=( $(ls -1 @PATH_ENVIRONMENT@) )
list=( $(ls -A1 @PATH_ENVIRONMENT@ | sort) )
for i in ${list[@]};do
var=$(<@PATH_ENVIRONMENT@/${i})
var=( $(<@PATH_ENVIRONMENT@/${i}) )
for j in ${var[@]}; do
export ${j}
export ${j}
done
done
......@@ -19,9 +19,9 @@ done
## Try consolekit
if 66-which -q ck-launch-session; then
cmd="exec ck-launch-session $@"
cmd="exec ck-launch-session $@"
else
cmd="exec $@"
cmd="exec $@"
fi
## Select the session to start
......
#!@BINDIR@/bash
list=( $(ls -1 @PATH_ENVIRONMENT@) )
list=( $(ls -A1 @PATH_ENVIRONMENT@ | sort) )
for i in ${list[@]};do
var=$(<@PATH_ENVIRONMENT@/${i})
var=( $(<@PATH_ENVIRONMENT@/${i}) )
for j in ${var[@]}; do
export ${j}
export ${j}
done
done
......
......@@ -16,76 +16,84 @@ home_env="${home}/${MOD_SERVICE_USERCONFDIR}svscan@${owner}"
die(){
66-yeller -fc "${@}"
exit 111
}
}
check_empty_var(){
name="${1}" var_value="${2}"
if [ -z "${var_value}" ]; then
die invalid value for variable: "${name}"
fi
name="${1}" var_value="${2}"
if [ -z "${var_value}" ]; then
die invalid value for variable: "${name}"
fi
}
enable(){
name="${1}"
66-yeller %benable%n service: "${name}"
touch "${MOD_MODULE_DIR}/service/${name}" || die "unable to enable ${MOD_MODULE_DIR}/service/${1}"
name="${1}"
66-yeller %benable%n service: "${name}"
touch "${MOD_MODULE_DIR}/service/${name}" || die "unable to enable ${MOD_MODULE_DIR}/service/${1}"
}
disable(){
name="${1}"
66-yeller %bdisable%n service: "${name}"
rm -f "${MOD_MODULE_DIR}/service/${name}" || die "disable to enable ${MOD_MODULE_DIR}/service/${1}"
name="${1}"
66-yeller %rdisable%n service: "${name}"
rm -f "${MOD_MODULE_DIR}/service/${name}" || die "disable to enable ${MOD_MODULE_DIR}/service/${1}"
}
if execl-toc -X -V DISPLAY_MANAGER; then
check_empty_var "DISPLAY_MANAGER" "${DISPLAY_MANAGER}"
enable "display-manager@${DISPLAY_MANAGER}"
66-yeller set environment at .xsession file to: %b"${home_env}"%n
sed -i "s:@PATH_ENVIRONMENT@:${home_env}:g" ".xsession" || die "unable to set environment directory at .xsession file"
if [ -e "${home}/.xsession" ]; then
66-yeller -W "move existing ${home}/.xsession file to ${home}/.xsession.bak"
mv "${home}/.xsession" "${home}/.xsession.bak" || exit 111
fi
66-yeller "create ${home}/.xsession"
cp .xsession "${home}/" || exit 111
chown "${uid}":"${gid}" "${home}/.xsession" || exit 111
check_empty_var "DISPLAY_MANAGER" "${DISPLAY_MANAGER}"
enable "display-manager@${DISPLAY_MANAGER}"
if ! [ -e "${MOD_SERVICE_ADMDIR}${DISPLAY_MANAGER}" ] && ! [ -e "${MOD_SERVICE_SYSDIR}${DISPLAY_MANAGER}" ]; then
die "the ${DISPLAY_MANAGER} frontend service file do not exist on your system -- please install it and try again"
fi
66-yeller set environment at .xsession file to: %b"${home_env}"%n
sed -i "s:@PATH_ENVIRONMENT@:${home_env}:g" ".xsession" || die "unable to set environment directory at .xsession file"
if [ -e "${home}/.xsession" ]; then
random=$(date +%M%N)
66-yeller -W "move existing ${home}/.xsession file to ${home}/.xsession-${random}.backup"
mv "${home}/.xsession" "${home}/.xsession-${random}.backup" || exit 111
fi
66-yeller "create ${home}/.xsession"
cp .xsession "${home}/" || exit 111
chown "${uid}":"${gid}" "${home}/.xsession" || exit 111
fi
if execl-toc -X -V CONSOLE_TRACKER; then
check_empty_var "CONSOLE_TRACKER" "${CONSOLE_TRACKER}"
enable "console-tracker@${CONSOLE_TRACKER}"
check_empty_var "CONSOLE_TRACKER" "${CONSOLE_TRACKER}"
if ! [ -e "${MOD_SERVICE_ADMDIR}${CONSOLE_TRACKER}" ] && ! [ -e "${MOD_SERVICE_SYSDIR}${CONSOLE_TRACKER}" ]; then
die "the ${CONSOLE_TRACKER} frontend service file do not exist on your system -- please install it and try again"
fi
enable "console-tracker@${CONSOLE_TRACKER}"
fi
if [ "${XDG_RUNTIME}" = "yes" ]; then
enable "mount-run@${owner}"
enable "mount-run@${owner}"
else
disable "mount-run@${owner}"
disable "mount-run@${owner}"
fi
if execl-toc -X -V DESKTOP_CMDLINE; then
check_empty_var "DESKTOP_CMDLINE" "${DESKTOP_CMDLINE}"
66-yeller set environment at .xinitrc file to: %b"${home_env}"%n
sed -i "s:@PATH_ENVIRONMENT@:${home_env}:g" ".xinitrc" || die "unable to set environment directory at .xinitrc file"
66-yeller set commandline at .xinitrc file to: %b"${DESKTOP_CMDLINE}"%n
sed -i "s:@DESKTOP_CMDLINE@:${DESKTOP_CMDLINE}:g" ".xinitrc" || die "unable to set environment directory at .xinitrc file"
if [ -e "${home}/.xinitrc" ]; then
66-yeller -W "move existing ${home}/.xinitrc file to ${home}/.xinitrc.bak"
mv "${home}/.xinitrc" "${home}/.xinitrc.bak" || exit 111
fi
66-yeller -c "create ${home}/.xinitrc"
cp .xinitrc "${home}/" || exit 111
chown "${uid}":"${gid}" "${home}/.xinitrc" || exit 111
check_empty_var "DESKTOP_CMDLINE" "${DESKTOP_CMDLINE}"
66-yeller set environment at .xinitrc file to: %b"${home_env}"%n
sed -i "s:@PATH_ENVIRONMENT@:${home_env}:g" ".xinitrc" || die "unable to set environment directory at .xinitrc file"
66-yeller set commandline at .xinitrc file to: %b"${DESKTOP_CMDLINE}"%n
sed -i "s:@DESKTOP_CMDLINE@:${DESKTOP_CMDLINE}:g" ".xinitrc" || die "unable to set environment directory at .xinitrc file"
if [ -e "${home}/.xinitrc" ]; then
random=$(date +%M%N)
66-yeller -W "move existing ${home}/.xinitrc file to ${home}/.xinitrc-${random}.backup"
mv "${home}/.xinitrc" "${home}/.xinitrc-${random}.backup" || exit 111
fi
66-yeller -c "create ${home}/.xinitrc"
cp .xinitrc "${home}/" || exit 111
chown "${uid}":"${gid}" "${home}/.xinitrc" || exit 111
fi
66-yeller "%bsuccessfully%n configured"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment