source: zero-lliurex-installers/trunk/fuentes/zero-lliurex-msad.zmds/zero-lliurex-msad.zmd @ 5349

Last change on this file since 5349 was 3622, checked in by jrpelegrina, 3 years ago

WIP in rename zero-lliurex-lite-extended, moodle, msad, notebook-bar, open-sysclonre, salt, technology

File size: 3.5 KB
Line 
1#!/bin/bash
2
3SUDOERS_TEMPFILE="$(mktemp /tmp/debconftemp.XXXXXXX)"
4chmod 700 $SUDOERS_TEMPFILE 
5
6config_lightdm(){
7
8        /usr/lib/lightdm/lightdm-set-defaults --show-manual-login true
9        /usr/lib/lightdm/lightdm-set-defaults --hide-users true
10        /usr/lib/lightdm/lightdm-set-defaults --allow-guest false
11}
12
13diversion_networkmanager_config(){
14
15        PACKAGE_NAME="zero-lliurex-msad"
16        DNSMASQ_CONF_FILE="/etc/NetworkManager/NetworkManager.conf"
17
18        if [ -f ${DNSMASQ_CONF_FILE}.real ];
19        then
20                rm -f ${DNSMASQ_CONF_FILE} || true
21                cp -f ${DNSMASQ_CONF_FILE}.real ${DNSMASQ_CONF_FILE}
22        else
23                cp -f ${DNSMASQ_CONF_FILE} ${DNSMASQ_CONF_FILE}.real
24        fi
25       
26       
27        sed 's/^dns=dnsmasq/\#dns=dnsmasq/g' ${DNSMASQ_CONF_FILE} > ${DNSMASQ_CONF_FILE}.diverted
28        rm -f ${DNSMASQ_CONF_FILE} || true
29        ln -fs ${DNSMASQ_CONF_FILE}.diverted ${DNSMASQ_CONF_FILE}
30        dpkg-divert --package ${PACKAGE_NAME} --rename --quiet --add --divert ${DNSMASQ_CONF_FILE}.real ${DNSMASQ_CONF_FILE}
31
32        chmod 644 ${DNSMASQ_CONF_FILE}.diverted
33
34        service network-manager restart
35}
36
37config_pbisopen(){
38
39        # Change default shell for domain users to bash
40        /opt/pbis/bin/config LoginShellTemplate /bin/bash
41        # Set the domain as default (not require <domain>\ to precede username for domain logins)
42        /opt/pbis/bin/config AssumeDefaultDomain true
43        # Set default user home dir
44        /opt/pbis/bin/config HomeDirTemplate %H/%D/%U
45        # Set default home dir umask
46        /opt/pbis/bin/config HomeDirUmask 077
47}
48
49add_domainadmins_to_sudoers(){
50        # Sets sudoers config writing lliurex-gva in /etc/sudoers.d
51        # By default, enable Domain administrators and adm_atec
52        # groups as privileged groups in a local machine
53
54        cat >> $SUDOERS_TEMPFILE << EOF
55# Members of these groups may gain root privileges
56%domain^administrators ALL=(ALL) ALL
57%adm_atec ALL=(ALL) ALL
58EOF
59       
60        cp $SUDOERS_TEMPFILE /etc/sudoers.d/lliurex-gva
61        chmod 440 /etc/sudoers.d/lliurex-gva
62}
63
64config_ntpdate(){
65        # Launch time configuration
66
67        SCRIPT_NTPDATE="/etc/cron.daily/lliurex-gva"
68        if [[ -x "$SCRIPT_NTPDATE" ]];
69        then
70            $SCRIPT_NTPDATE
71        fi
72}
73
74diversion_pam_windbind(){
75       
76        PACKAGE_NAME="zero-lliurex-msad"
77        WINBIND_CONF_FILE="/usr/share/pam-config/winbind"
78        mkdir /usr/share/llx-pam-configs/diverted/ -p
79        dpkg-divert --package ${PACKAGE_NAME} --rename --quiet --add --divert /usr/share/llx-pam-configs/diverted/winbind.diverted ${WINBIND_CONF_FILE}
80
81}
82
83
84# Reconfigure DNS name resolution. Disable dnsmasq
85##################################################
86diversion_networkmanager_config
87# Divert winbind pam file. Pbis pam module has conflict with winbind
88####################################################################
89diversion_pam_windbind
90# Install PowerBroker Identity Services for Active Directory Bridging packages
91##############################################################################
92synaptic --hide-main-window --non-interactive  --set-selections-file /usr/share/zero-lliurex-installers/zero-lliurex-msad
93sleep 2
94
95# Configure ntpdate
96###################
97config_ntpdate
98
99# Set Domain Admins to sudoers
100##############################
101add_domainadmins_to_sudoers
102
103# Lightdm Configuration
104#######################
105config_lightdm
106
107# PBIS Open Configuration
108#########################
109config_pbisopen
110
111# Disable zero-lliurex-msad
112###########################
113
114rm -f ${SUDOERS_TEMPFILE}
115zero-sqlmanager -s zero-lliurex-msad 1
116
117# CREATE THE TOKEN #
118####################
119
120mkdir -p /usr/share/lliurex-gva/
121touch /usr/share/lliurex-gva/joined
122date > /usr/share/lliurex-gva/joined
123
124# Join LliureX PC to domain
125###########################
126/opt/pbis/bin/domainjoin-gui configure --enable pam
127
128
129exit 0
Note: See TracBrowser for help on using the repository browser.