summaryrefslogtreecommitdiff
path: root/configs/profile/root-image/root/.session/install/chroot-environment.sh
blob: 6a074fbdcf70d36664e3620f8a667450514957d7 (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
33
34
35
36
37
38
39
40
41
42
#!/bin/bash

source /root/session-common.sh.inc


# configure hostname
echo $(GetStateVar 'HOSTNAME') > /etc/hostname

# configure timezone
ln -s /usr/share/zoneinfo/$(GetStateVar 'TIMEZONE') /etc/localtime

# configure keymap
echo "KEYMAP=$(GetStateVar 'KEYMAP')" > /etc/vconsole.conf

# configure locales
locales=$(echo $(GetStateVar 'LOCALES') | sed -e 's/" "/\n/g' -e 's/ /#/g' -e 's/"//g')
for locale in ${locales[@]}
do locale=$(echo ${locale} | sed -e 's/#/ /g')
   sed -i -e "s/#${locale}/${locale}/g" /etc/locale.gen
done
locale-gen

# configure language
echo "LANG=$(GetStateVar 'LANGUAGE')" > /etc/locale.conf

# prepare initrd
mkinitcpio -p linux-libre

# install and configure GRUB
if   [[ "$(GetStateVar 'BOOT')" == 'grub' ]]
then device=$(GetStateVar 'DEVICE')
     grub-install ${device}
     grub-mkconfig -o /boot/grub/grub.cfg

     # enable Parabola GRUB theme
     sed -i "$GRUB_THEME_SED_CMD" /mnt/etc/default/grub
fi

# configure root login
usermod -p $(openssl passwd $(GetStateVar 'ROOT_PASS')) root

exit