OSDN Git Service

4ad9af5e2e83d4a2c87886bff874444a7971eb3b
[instantos/instantARCH.git] / chroot / chroot.sh
1 #!/bin/bash
2
3 # enable all sorts of configuration concerning login, lightdm, networking and grub
4
5 # enable lightdm greeter
6 if grep -q 'greeter-session' /etc/lightdm/lightdm.conf; then
7     LASTSESSION="$(grep 'greeter-session' /etc/lightdm/lightdm.conf | tail -1)"
8     sed -i "s/$LASTSESSION/greeter-session=lightdm-gtk-greeter/g" /etc/lightdm/lightdm.conf
9 else
10     sed -i 's/^\[Seat:\*\]/\[Seat:\*\]\ngreeter-session=lightdm-gtk-greeter/g' /etc/lightdm/lightdm.conf
11 fi
12
13 # set up instantwm as a default user session
14 if grep -q '^user-session.*' /etc/lightdm/lightdm.conf; then
15     echo "adjusting user session"
16     sed -i 's/^user-session=.*/user-session=instantwm/g' /etc/lightdm/lightdm.conf
17 fi
18
19 # fix gui not showing up
20 sed -i 's/^#logind-check-graphical=.*/logind-check-graphical=true/' /etc/lightdm/lightdm.conf
21
22 echo '# modified by instantARCH' >>/etc/lightdm/lightdm.conf
23
24 # needed to get internet to work
25 if ! [ -e /opt/topinstall ] && ! iroot partswap; then
26     if command -v systemctl; then
27         if ! grep -iq manjaro /etc/os-release; then
28             # enable swap
29             systemctl enable systemd-swap
30             {
31                 echo "swapfc_enabled=1"
32                 echo "swapfc_max_count=8"
33             } >>/etc/systemd/swap.conf
34         fi
35     fi
36 fi
37
38 sed -i 's/# %wheel/%wheel/g' /etc/sudoers
39 echo 'Defaults env_reset,pwfeedback' >>/etc/sudoers
40
41 if command -v systemctl; then
42     systemctl enable lightdm
43     systemctl enable NetworkManager
44 fi
45
46 if ! command -v update-grub &>/dev/null; then
47     # can't include this in package
48     echo '#! /bin/sh
49 grub-mkconfig -o /boot/grub/grub.cfg' >/usr/bin/update-grub
50     chmod 755 /usr/bin/update-grub
51 fi
52
53 # indicator file
54 if iroot kvm; then
55     [ -e /opt/instantos ] || mkdir -p /opt/instantos
56     echo "kvm" >/opt/instantos/kvm
57 fi