Skip to content

Conversation

@SunilSherkhane
Copy link
Contributor

@SunilSherkhane SunilSherkhane commented Nov 30, 2025

  • Polkit rules implemented for proper device and filesystem access
  • System clock aligned to BIOS hardware time
  • LightDM configured as the default display manager, replacing SDDM
  • Plasma NTP synchronization issue corrected
  • Wayland enabled as the default Plasma session

Summary by Sourcery

Switch the Plasma desktop configuration to use LightDM with a Wayland-based Plasma session while updating system time, device access, and core desktop settings.

New Features:

  • Configure LightDM as the default display manager with a KDE greeter for Plasma sessions.
  • Enable Wayland as the default Plasma session via updated xinit configuration.

Bug Fixes:

  • Align system clock handling with BIOS hardware time and ensure NTP services start and synchronize correctly to address previous time sync issues.

Enhancements:

  • Relax device filesystem permissions and sysctl settings to support user mounting and improved local stream buffering.
  • Add Polkit rules to allow wheel group users to mount filesystems via udisks2.
  • Standardize keyboard layout and Caps Lock/Control swap in default xinit configs for live, root, and skeleton users.

@SunilSherkhane SunilSherkhane requested review from a team as code owners November 30, 2025 18:51
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 30, 2025

Reviewer's Guide

Switches Plasma desktop configuration from SDDM/X11 to LightDM/Wayland, aligns system time and NTP settings, adjusts kernel/sysctl and devfs permissions for user mounting, and sets up Polkit rules and X init defaults for the live user, root, and skeleton.

Sequence diagram for LightDM login and Plasma Wayland session startup

sequenceDiagram
    actor User
    participant LightDM
    participant lightdm_conf as LightDM_config
    participant xinitrc as Xinitrc
    participant dbus_daemon as Dbus
    participant ck_session as ConsoleKit
    participant startplasma_wayland as Plasma

    User->>LightDM: Enter credentials
    LightDM->>lightdm_conf: Read greeter-session and user-session
    lightdm_conf-->>LightDM: greeter-session=slick-greeter
    lightdm_conf-->>LightDM: user-session=plasma

    LightDM->>User: Start Plasma session
    User->>xinitrc: Run startx (live_user/root/skel)
    xinitrc->>xinitrc: setxkbmap us
    xinitrc->>xinitrc: setxkbmap -option ctrl:swapcaps

    xinitrc->>dbus_daemon: exec dbus-launch --exit-with-session
    dbus_daemon->>ck_session: ck-launch-session
    ck_session->>startplasma_wayland: startplasma-wayland
    startplasma_wayland-->>User: Plasma Wayland desktop ready
Loading

File-Level Changes

Change Details Files
Replace SDDM-specific setup with LightDM configuration and KDE greeter customization, and adjust rc.conf for NTP.
  • Remove sddm_setup and all SDDM autologin/theme handling logic
  • Add update_rcconf_dm to append ntpdate_hosts to rc.conf
  • Add lightdm_setup to set slick-greeter and Plasma as default session in lightdm.conf
  • Add lightdm_kde_greeter_conf to configure lightdm-kde-greeter via a drop-in config directory
  • Wire new LightDM-related functions into the main execution flow
desktop_config/plasma.sh
Enable BIOS-aligned system time and fix Plasma NTP synchronization behavior via rc.conf and localtime management.
  • Add set_localtime_from_bios to symlink /etc/localtime to UTC within the release image
  • Clean existing ntpd/local_unbound settings and re-add ntpd_enable, ntpd_sync_on_start and ntpdate_enable in rc.conf
  • Invoke set_localtime_from_bios in the main setup sequence
desktop_config/plasma.sh
Tune Plasma-related system parameters (sysctl) and device filesystem rules to support user mounting and better local socket behavior.
  • Add plasma_settings to normalize and set net.local.stream recv/send buffer sizes and enable vfs.usermount in sysctl.conf
  • Add configure_devfs to create a local devfs ruleset for da* devices with world-writable, operator-group permissions and register it in rc.conf
  • Ensure new functions run before final setup
desktop_config/plasma.sh
common_config/base-setting/patches/etc/devfs.rules.extra
Introduce Polkit rules to allow wheel users to mount filesystems via udisks2.
  • Add setup_polkit_rules to create /usr/local/etc/polkit-1/rules.d
  • Create 10-mount.rules granting YES for udisks2 filesystem mount actions when subject is in wheel group
  • Call setup_polkit_rules in the main execution block
desktop_config/plasma.sh
Switch default Plasma session from X11 to Wayland and standardize xinit keyboard and session setup for live user, root, and skeleton.
  • Extend setup_xinit to add keyboard layout and Caps/Ctrl swap commands to the live user .xinitrc while keeping lock screen disabled
  • Change the exec line to use dbus-launch with ck-launch-session startplasma-wayland and redirect errors to .error.log for the live user
  • Replace root and skel .xinitrc with keyboard config plus Wayland start command
  • Ensure idempotent appends via grep checks for the live user .xinitrc
desktop_config/plasma.sh
packages/plasma
packages/vital/plasma

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Several helpers (update_rcconf_dm, configure_devfs, plasma_settings, set_localtime_from_bios) always append settings to rc.conf, devfs.rules, and sysctl.conf without checking for existing entries, which will lead to duplicate/conflicting lines when the script is rerun; consider normalizing/removing any existing keys before appending or using sed to update in place as you did for some other options.
  • lightdm_setup assumes ${release}/usr/local/etc/lightdm/lightdm.conf already exists, so sed -i will fail on a fresh install; add a guard to create a minimal config or skip updates if the file is missing.
  • set_localtime_from_bios unconditionally forces localtime to UTC and wipes any existing ntpd_enable, ntpd_sync_on_start, and local_unbound_enable settings, which can override user/system-specific configuration; consider making this behavior conditional or updating only the specific keys you need to change without deleting unrelated settings.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Several helpers (`update_rcconf_dm`, `configure_devfs`, `plasma_settings`, `set_localtime_from_bios`) always append settings to `rc.conf`, `devfs.rules`, and `sysctl.conf` without checking for existing entries, which will lead to duplicate/conflicting lines when the script is rerun; consider normalizing/removing any existing keys before appending or using `sed` to update in place as you did for some other options.
- `lightdm_setup` assumes `${release}/usr/local/etc/lightdm/lightdm.conf` already exists, so `sed -i` will fail on a fresh install; add a guard to create a minimal config or skip updates if the file is missing.
- `set_localtime_from_bios` unconditionally forces `localtime` to UTC and wipes any existing `ntpd_enable`, `ntpd_sync_on_start`, and `local_unbound_enable` settings, which can override user/system-specific configuration; consider making this behavior conditional or updating only the specific keys you need to change without deleting unrelated settings.

## Individual Comments

### Comment 1
<location> `desktop_config/plasma.sh:11-14` </location>
<code_context>
-
-[General]
-Numlock=on
+update_rcconf_dm() {
+  rc_conf="${release}/etc/rc.conf"
+  echo 'ntpdate_hosts="asia.pool.ntp.org"' >> "${rc_conf}"
+}
+
</code_context>

<issue_to_address>
**suggestion:** Make rc.conf updates idempotent to avoid accumulating duplicate ntpdate_hosts entries.

Because this script may run multiple times on an existing rc.conf, always appending the line can create duplicate ntpdate_hosts entries. Either delete any existing `^ntpdate_hosts=` lines (e.g. `sed -i '' '/^ntpdate_hosts=.*/d'`) before appending, or only append if `ntpdate_hosts="asia.pool.ntp.org"` is not already present. This keeps rc.conf idempotent and easier to maintain.

```suggestion
update_rcconf_dm() {
  rc_conf="${release}/etc/rc.conf"

  # Ensure rc.conf exists before we try to edit it
  mkdir -p "$(dirname "${rc_conf}")"
  touch "${rc_conf}"

  # Remove any existing ntpdate_hosts lines to keep the setting idempotent
  sed -i '' '/^ntpdate_hosts=.*/d' "${rc_conf}"

  # Append the desired ntpdate_hosts configuration
  echo 'ntpdate_hosts="asia.pool.ntp.org"' >> "${rc_conf}"
}
```
</issue_to_address>

### Comment 2
<location> `desktop_config/plasma.sh:31-40` </location>
<code_context>
+set_localtime_from_bios() {
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Align rc.conf ntpd/ntpdate writes with the deletion logic to avoid duplicate entries.

In `set_localtime_from_bios`, `ntpdate_enable` is only appended, so an existing `ntpdate_enable` line in rc.conf would remain, leading to conflicting/duplicate settings. Please remove any existing `^ntpdate_enable=` line before appending, matching the handling of the other keys. A shared helper for rc.conf mutations could also keep this logic consistently idempotent.

Suggested implementation:

```
  rm -f "${tz_target}"
  ln -s /usr/share/zoneinfo/UTC "${tz_target}"

  # Ensure ntpdate_enable in rc.conf is set idempotently and without duplicates
  if [ -f "${release}/etc/rc.conf" ]; then
    # Remove any existing ntpdate_enable line before appending our desired setting
    sed -i '' -e '/^ntpdate_enable=/d' "${release}/etc/rc.conf"
    printf '%s\n' 'ntpdate_enable="YES"' >> "${release}/etc/rc.conf"
  fi

```

If other time-sync related keys (e.g. `ntpd_enable`, `ntpd_sync_on_start`) are being set elsewhere in this script, consider factoring the repeated `sed`/append logic into a small helper, e.g.:

- A function like `set_rc_conf_kv key value` that:
  1. `sed -i '' -e "/^${key}=*/d"` on `${release}/etc/rc.conf`
  2. Appends `key="value"`.

Then call that helper from `set_localtime_from_bios` and any other places where `rc.conf` is mutated, to keep behavior consistent and idempotent.
</issue_to_address>

### Comment 3
<location> `desktop_config/plasma.sh:85-92` </location>
<code_context>
+
+}
+
+configure_devfs() {
+  devfs_rules="${release}/etc/devfs.rules"
+  rc_conf="${release}/etc/rc.conf"
+
+  echo '[localrules=10]' >> "${devfs_rules}"
+  echo "add path 'da*' mode 0666 group operator" >> "${devfs_rules}"
+  echo 'devfs_system_ruleset="localrules"' >> "${rc_conf}"
+}
+
</code_context>

<issue_to_address>
**suggestion:** Make devfs and rc.conf rule additions safe for multiple invocations.

Right now this always appends `[localrules=10]` and `devfs_system_ruleset="localrules"`. If the script runs more than once or the base image already contains these entries, you’ll get duplicate sections/lines. Please guard the writes (e.g. `grep -q '\[localrules=10\]' "${devfs_rules}" || echo '[localrules=10]' >> ...` and similarly for `devfs_system_ruleset`) so the config remains deterministic and free of duplicates.

```suggestion
configure_devfs() {
  devfs_rules="${release}/etc/devfs.rules"
  rc_conf="${release}/etc/rc.conf"

  # Add localrules section only if it doesn't already exist
  if ! grep -q '^\[localrules=10\]' "${devfs_rules}" 2>/dev/null; then
    echo '[localrules=10]' >> "${devfs_rules}"
  fi

  # Add the da* rule only if it isn't already present
  if ! grep -q "^[[:space:]]*add path 'da\*' mode 0666 group operator" "${devfs_rules}" 2>/dev/null; then
    echo "add path 'da*' mode 0666 group operator" >> "${devfs_rules}"
  fi

  # Ensure devfs_system_ruleset is configured only once
  if ! grep -q '^[[:space:]]*devfs_system_ruleset="localrules"' "${rc_conf}" 2>/dev/null; then
    echo 'devfs_system_ruleset="localrules"' >> "${rc_conf}"
  fi
}
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 11 to 14
update_rcconf_dm() {
rc_conf="${release}/etc/rc.conf"
echo 'ntpdate_hosts="asia.pool.ntp.org"' >> "${rc_conf}"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Make rc.conf updates idempotent to avoid accumulating duplicate ntpdate_hosts entries.

Because this script may run multiple times on an existing rc.conf, always appending the line can create duplicate ntpdate_hosts entries. Either delete any existing ^ntpdate_hosts= lines (e.g. sed -i '' '/^ntpdate_hosts=.*/d') before appending, or only append if ntpdate_hosts="asia.pool.ntp.org" is not already present. This keeps rc.conf idempotent and easier to maintain.

Suggested change
update_rcconf_dm() {
rc_conf="${release}/etc/rc.conf"
echo 'ntpdate_hosts="asia.pool.ntp.org"' >> "${rc_conf}"
}
update_rcconf_dm() {
rc_conf="${release}/etc/rc.conf"
# Ensure rc.conf exists before we try to edit it
mkdir -p "$(dirname "${rc_conf}")"
touch "${rc_conf}"
# Remove any existing ntpdate_hosts lines to keep the setting idempotent
sed -i '' '/^ntpdate_hosts=.*/d' "${rc_conf}"
# Append the desired ntpdate_hosts configuration
echo 'ntpdate_hosts="asia.pool.ntp.org"' >> "${rc_conf}"
}

Comment on lines 31 to 40
set_localtime_from_bios() {
tz_target="${release}/etc/localtime"

grep -q "^\[Theme\]" "${sddm_conf}" || echo "[Theme]" >> "${sddm_conf}"
sed -i '' "s@^Current=.*@Current=breeze@" "${sddm_conf}" || echo "Current=breeze" >> "${sddm_conf}"
rm -f "${tz_target}"
ln -s /usr/share/zoneinfo/UTC "${tz_target}"

grep -q "^\[General\]" "${sddm_conf}" || echo "[General]" >> "${sddm_conf}"
sed -i '' "s@^Numlock=.*@Numlock=on@" "${sddm_conf}" || echo "Numlock=on" >> "${sddm_conf}"
fi
rc_conf="${release}/etc/rc.conf"
sed -i '' '/^ntpd_enable=.*/d' "${rc_conf}" 2>/dev/null || true
sed -i '' '/^ntpd_sync_on_start=.*/d' "${rc_conf}" 2>/dev/null || true
sed -i '' '/^local_unbound_enable=.*/d' "${rc_conf}" 2>/dev/null || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Align rc.conf ntpd/ntpdate writes with the deletion logic to avoid duplicate entries.

In set_localtime_from_bios, ntpdate_enable is only appended, so an existing ntpdate_enable line in rc.conf would remain, leading to conflicting/duplicate settings. Please remove any existing ^ntpdate_enable= line before appending, matching the handling of the other keys. A shared helper for rc.conf mutations could also keep this logic consistently idempotent.

Suggested implementation:

  rm -f "${tz_target}"
  ln -s /usr/share/zoneinfo/UTC "${tz_target}"

  # Ensure ntpdate_enable in rc.conf is set idempotently and without duplicates
  if [ -f "${release}/etc/rc.conf" ]; then
    # Remove any existing ntpdate_enable line before appending our desired setting
    sed -i '' -e '/^ntpdate_enable=/d' "${release}/etc/rc.conf"
    printf '%s\n' 'ntpdate_enable="YES"' >> "${release}/etc/rc.conf"
  fi

If other time-sync related keys (e.g. ntpd_enable, ntpd_sync_on_start) are being set elsewhere in this script, consider factoring the repeated sed/append logic into a small helper, e.g.:

  • A function like set_rc_conf_kv key value that:
    1. sed -i '' -e "/^${key}=*/d" on ${release}/etc/rc.conf
    2. Appends key="value".

Then call that helper from set_localtime_from_bios and any other places where rc.conf is mutated, to keep behavior consistent and idempotent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

1 participant