11#! /bin/sh
2- #
3- # FreeBSD Plasma + LightDM live setup script
4- #
52
63set -e -u
74
@@ -13,23 +10,28 @@ set -e -u
1310
1411update_rcconf_dm () {
1512 rc_conf=" ${release} /etc/rc.conf"
16-
17- # Enable SDDM
18- echo ' lightdm_enable="YES"' >> " ${rc_conf} "
13+ echo ' ntpdate_hosts="asia.pool.ntp.org"' >> " ${rc_conf} "
1914}
2015
2116lightdm_setup () {
2217 lightdm_conf=" ${release} /usr/local/etc/lightdm/lightdm.conf"
23-
2418 sed -i ' ' " s@#greeter-session=.*@greeter-session=slick-greeter@" " ${lightdm_conf} "
2519 sed -i ' ' " s@#user-session=default@user-session=plasma@" " ${lightdm_conf} "
2620}
2721
22+ # ADD: Enable KDE Greeter
23+ lightdm_kde_greeter_conf () {
24+ mkdir -p " ${release} /usr/local/etc/lightdm/lightdm.conf.d"
25+ cat << EOF > "${release} /usr/local/etc/lightdm/lightdm.conf.d/50-myconfig.conf"
26+ [Seat:*]
27+ greeter-session=lightdm-kde-greeter
28+ EOF
29+ }
30+
2831set_localtime_from_bios () {
2932 tz_target=" ${release} /etc/localtime"
3033
3134 rm -f " ${tz_target} "
32-
3335 ln -s /usr/share/zoneinfo/UTC " ${tz_target} "
3436
3537 rc_conf=" ${release} /etc/rc.conf"
@@ -39,6 +41,7 @@ set_localtime_from_bios() {
3941
4042 echo ' ntpd_enable="YES"' >> " ${rc_conf} "
4143 echo ' ntpd_sync_on_start="YES"' >> " ${rc_conf} "
44+ echo ' ntpdate_enable="YES"' >> " ${rc_conf} "
4245}
4346
4447plasma_settings () {
@@ -49,51 +52,52 @@ plasma_settings() {
4952
5053 echo ' net.local.stream.recvspace=65536' >> " ${sysctl_conf} "
5154 echo ' net.local.stream.sendspace=65536' >> " ${sysctl_conf} "
52-
53- # Allow regular users to mount filesystems.
5455 echo ' vfs.usermount=1' >> " ${sysctl_conf} "
5556}
5657
5758setup_xinit () {
58- # Configure Plasma session settings and fallback .xinitrc
5959 chroot " ${release} " su " ${live_user} " -c "
6060 mkdir -p /home/${live_user} /.config
61+
62+ # Disable lock screen
6163 kwriteconfig5 --file /home/${live_user} /.config/kscreenlockerrc --group Daemon --key Autolock false
6264 kwriteconfig5 --file /home/${live_user} /.config/kscreenlockerrc --group Daemon --key LockOnResume false
63- grep -qxF 'exec ck-launch-session startplasma-x11' /home/${live_user} /.xinitrc || echo 'exec ck-launch-session startplasma-x11' >> /home/${live_user} /.xinitrc "
64- echo " exec ck-launch-session startplasma-x11" > " ${release} /root/.xinitrc"
65- echo " exec ck-launch-session startplasma-x11" > " ${release} /usr/share/skel/dot.xinitrc"
66- }
6765
68- configure_user_groups () {
69- # Add the live user to necessary groups for system and hardware access
70- chroot " ${release} " pw usermod " ${live_user} " -G wheel,operator,video
66+ # Add keyboard config
67+ grep -qxF 'setxkbmap us' /home/${live_user} /.xinitrc || echo 'setxkbmap us' >> /home/${live_user} /.xinitrc
68+ grep -qxF 'setxkbmap -option ctrl:swapcaps' /home/${live_user} /.xinitrc || echo 'setxkbmap -option ctrl:swapcaps' >> /home/${live_user} /.xinitrc
69+
70+ # Plasma session
71+ grep -qxF 'exec dbus-launch --exit-with-session ck-launch-session startplasma-wayland 2> .error.log' /home/${live_user} /.xinitrc \
72+ || echo 'exec dbus-launch --exit-with-session ck-launch-session startplasma-wayland 2> .error.log' >> /home/${live_user} /.xinitrc
73+ "
74+
75+ echo " setxkbmap us" > " ${release} /root/.xinitrc"
76+ echo " setxkbmap -option ctrl:swapcaps" >> " ${release} /root/.xinitrc"
77+ echo " exec dbus-launch --exit-with-session ck-launch-session startplasma-wayland 2> .error.log" >> " ${release} /root/.xinitrc"
78+
79+ echo " setxkbmap us" > " ${release} /usr/share/skel/.xinitrc"
80+ echo " setxkbmap -option ctrl:swapcaps" >> " ${release} /usr/share/skel/.xinitrc"
81+ echo " exec dbus-launch --exit-with-session ck-launch-session startplasma-wayland 2> .error.log" >> " ${release} /usr/share/skel/.xinitrc"
82+
7183}
7284
7385configure_devfs () {
7486 devfs_rules=" ${release} /etc/devfs.rules"
7587 rc_conf=" ${release} /etc/rc.conf"
7688
77- # Create a local ruleset for devfs
7889 echo ' [localrules=10]' >> " ${devfs_rules} "
79- # Add rule to allow users in the 'operator' group to access USB storage devices
8090 echo " add path 'da*' mode 0666 group operator" >> " ${devfs_rules} "
81-
82- # Enable this ruleset on boot
8391 echo ' devfs_system_ruleset="localrules"' >> " ${rc_conf} "
8492}
8593
8694setup_polkit_rules () {
8795 polkit_rules_dir=" ${release} /usr/local/etc/polkit-1/rules.d"
8896 polkit_rules_file=" ${polkit_rules_dir} /10-mount.rules"
8997
90- # Ensure the directory exists
9198 mkdir -p " ${polkit_rules_dir} "
9299
93- # Create the polkit rule file for passwordless mounting
94100 cat << EOF > "${polkit_rules_file} "
95- // Allow udisks2 to mount devices without authentication
96- // for users in the "wheel" group.
97101polkit.addRule(function(action, subject) {
98102 if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" ||
99103 action.id == "org.freedesktop.udisks2.filesystem-mount") &&
@@ -106,13 +110,12 @@ EOF
106110
107111# Execute setup routines
108112patch_etc_files
109- patch_loader_conf_d
110113community_setup_liveuser
111114community_setup_autologin
112- configure_user_groups
113115configure_devfs
114116update_rcconf_dm
115117lightdm_setup
118+ lightdm_kde_greeter_conf
116119set_localtime_from_bios
117120plasma_settings
118121setup_polkit_rules
0 commit comments