Advertisement
Guest User

Untitled

a guest
May 9th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. diff --git a/packages/user-setup/user-setup-apply b/packages/user-setup/user-setup-apply
  2. index 56b2357..173815b 100755
  3. --- a/packages/user-setup/user-setup-apply
  4. +++ b/packages/user-setup/user-setup-apply
  5. @@ -25,10 +25,23 @@ fi
  6. # Pass in three arguments: the user, the password, and 'true' if the
  7. # password has been pre-crypted (by preseeding).
  8. setpassword () {
  9. - local USER PASSWD OPTS
  10. + local USER PASSWD OPTS VERSION LEGACY
  11. USER="$1"
  12. PASSWD="$2"
  13. - if [ "$3" = true ]; then
  14. +
  15. + # legacy support for versions that aren't using the PAM support
  16. + VERSION=`$chroot dpkg -s passwd | sed -n '/^Version:/s,^Version: ,,p'`
  17. + LEGACY=
  18. + if $chroot dpkg --compare-versions $VERSION lt 1:4.1.4-1; then
  19. + LEGACY=true
  20. + if [ "$3" = true ]; then
  21. + OPTS=-e
  22. + else
  23. + OPTS=-m
  24. + fi
  25. + fi
  26. +
  27. + if [ "$3" = true ] && [ -z "$LEGACY" ]; then
  28. $chroot $ROOT usermod --password=$PASSWD $USER
  29. else
  30. $chroot $ROOT chpasswd $OPTS <<EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement