forked from mdrjr/odroid-utility
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxorg_config.sh
79 lines (59 loc) · 1.43 KB
/
xorg_config.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
xorg_config() {
get_board
CC=$(whiptail --backtitle "Hardkernel ODROID Utility v$_REV" --menu "Xorg Config" 0 0 1 --cancel-button "Exit" --ok-button "Select" \
"1" "Enable Xorg" \
"2" "Disable Xorg" \
3>&1 1>&2 2>&3)
ret=$?
if [ $ret -eq 1 ]; then
return 0
elif [ $ret -eq 0 ]; then
case "$CC" in
1)
enable_xorg_at_boot
REBOOT=1
;;
2)
disable_xorg_at_boot
REBOOT=1
;;
*) ;;
esac
fi
}
enable_xorg_at_boot() {
# SystemD on Ubuntu 15.04
if [ "$BOARD" = "odroidxu3" ]; then
if [ "$DISTRO_VERSION" = "15.04" ] || [ "$DISTRO_VERSION" = "15.10" ]; then
systemctl set-default graphical.target
return
fi
fi
if [ "$DISTRO" = "ubuntu" ]; then
rm -fr /etc/init/lightdm.override
elif [ "$DISTRO" = "debian" ]; then
update-rc.d lightdm enable 2 3 4 5
else
xorg_err_not_supported
fi
}
disable_xorg_at_boot() {
# SystemD on Ubuntu 15.04
if [ "$BOARD" = "odroidxu3" ];then
if [ "$DISTRO_VERSION" = "15.04" ] || [ "$DISTRO_VERSION" = "15.10" ]; then
systemctl set-default multi-user.target
return
fi
fi
if [ "$DISTRO" = "ubuntu" ]; then
echo "manual" > /etc/init/lightdm.override
elif [ "$DISTRO" = "debian" ]; then
update-rc.d lightdm disable 2 3 4 5
else
xorg_err_not_supported
fi
}
xorg_err_not_supported() {
whiptail --backtitle "Hardkernel ODROID Utility v$_REV" --msgbox "XORG: Your distro isn't supported. Report this on the forums" 0 0 0
}