Skip to content

Commit

Permalink
Add switch-passwd
Browse files Browse the repository at this point in the history
Add Source for /sbin/switch-passwd and switch-passwd.service.

The script switch-passwd changes /etc/passwd into a symlink
to passwd.mariux (which is disted) and removes "nis" as
a passwd source from /etc/nsswitch.conf. These changes
are not done, if already done or if gdm is running.

On systems with gdm (workstations) which can't upgrade
immediately, the service switch-passwd.service is used
to do the switch on the next boot.

/etc/passwd and /etc/nsswitch.conf are temporarily disabled
from pdist on the Distmaster to allow a rolling upgrade.

After these files are distributed, all system should execute

    /sbin/switch-passwd    # attempt immediate switch
    systemctl enable switch-passwd.service

After all systems have upgraded (immediate or after reboot) we
can re-enable /etc/passwd and /etc/nsswitch.conf in the Distfile
and remove these switch-passwd files.
  • Loading branch information
donald committed Dec 11, 2017
1 parent e287015 commit 0355b7e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,7 @@ install_exec pdist/pdist "$DESTDIR$usrlocal_bindir/pdis
install_exec pmirror/pmirror "$DESTDIR$usrlocal_bindir/pmirror"
install_exec prun/prun "$DESTDIR$usr_bindir/prun"
install_exec put_websafe/put_websafe "$DESTDIR$usrlocal_bindir/put_websafe"
install_exec switch-passwd/switch-passwd "$DESTDIR$root_sbindir/switch-passwd"
install_data switch-passwd/switch-passwd.service "$DESTDIR$systemdunitdir/switch-passwd.service"

exit
11 changes: 11 additions & 0 deletions switch-passwd/switch-passwd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /bin/sh
test -L /etc/passwd && exit
systemctl status gdm.service >/dev/null && exit

set -e

sed -e 's/passwd: files students nis/passwd: files students/' < /etc/nsswitch.conf > /etc/nsswitch.conf.new
ln -sf passwd.mariux /etc/passwd.new

mv /etc/passwd.new /etc/passwd
mv /etc/nsswitch.conf.new /etc/nsswitch.conf
10 changes: 10 additions & 0 deletions switch-passwd/switch-passwd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Before=gdm.service

[Install]
WantedBy=basic.target

[Service]
Type=oneshot
ExecStart=/sbin/switch-passwd
RemainAfterExit=true

0 comments on commit 0355b7e

Please sign in to comment.