-
Eric Vidal authoredEric Vidal authored
customizeChroot 2.84 KiB
#!@BINDIR@/bash
# Copyright (c) 2015-2018 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution.
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
sourcing(){
local list
for list in /tmp/obarun-install-tmp/install.conf /usr/lib/obarun/util.sh; do
if [[ -f "${list}" ]]; then
source "${list}"
else
out_error "Missing file : ${list}"
exit
fi
done
unset list
}
sourcing
custo_once() {
local _tmp cmd
cmd="${1}"
_tmp="/tmp/obarun-install-tmp"
if [[ ! -d $_tmp ]]; then
mkdir -p -m0755 $_tmp || die "Impossible to create $_tmp"
fi
if [[ ! -e $_tmp/customize.${cmd} ]]; then
"${cmd}" || die "Cannot execute $_"
touch $_tmp/customize.${cmd}
else
return
fi
unset _tmp
}
############################## only modifie this script after this line ############################
create_log_user(){
out_action "add ${NEWUSER} at log group"
gpasswd -a "$NEWUSER" log
}
custo_once create_log_user
## Configure S6 service
config_s6(){
out_action "Enable syslogds6 service"
cp -ra /etc/s6-serv/available/classic/syslogds6 /etc/s6-serv/enabled/classic/
out_action "Enable dbus service"
cp -ra /etc/s6-serv/available/classic/dbus /etc/s6-serv/enabled/classic/
out_action "Enable consolekit service"
cp -ra /etc/s6-serv/available/classic/consolekit /etc/s6-serv/enabled/classic/
out_action "Enable ntpd service"
cp -ra /etc/s6-serv/available/classic/ntpd /etc/s6-serv/enabled/classic/
out_action "Create Live database"
s6opts add live bundle-Networkmanager
s6opts compile Live live
out_action "Make Live as current database"
rm /etc/s6-serv/enabled/rc/compiled/current
ln -sf /etc/s6-serv/enabled/rc/compiled/Live /etc/s6-serv/enabled/rc/compiled/current
out_action "Create directories for user supervision tree"
su "${NEWUSER}" -c "s6opts user"
out_action "Enable dbus service for ${NEWUSER} user"
su "${NEWUSER}" -c "cp -ra /etc/s6-serv/available/user/classic/dbus /home/${NEWUSER}/service/enabled/classic/"
out_action "Create ${NEWUSER} log directory for dbus"
su "${NEWUSER}" -c "s6opts checklog dbus"
out_action "Create User-live database"
su "${NEWUSER}" -c "s6opts add user-live xdg-user-dirs-oneshot"
su "${NEWUSER}" -c "s6opts compile User-live user-live"
out_action "Make User-live as current database"
rm /home/"${NEWUSER}"/service/enabled/rc/compiled/current
ln -sf /home/"${NEWUSER}"/service/enabled/rc/compiled/Live /home/"${NEWUSER}"/service/enabled/rc/compiled/current
}
custo_once config_s6
## Configure pulseaudio
config_pulse(){
echo "load-module module-device-manager" >> /etc/pulse/default.pa
}
custo_once config_pulse
out_valid "Customization terminate"