Advertisement
Guest User

Untitled

a guest
May 9th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. From 607dc2fe724748617498d79f22be82816f95014e Mon Sep 17 00:00:00 2001
  2. From: Otavio Salvador <otavio@ossystems.com.br>
  3. Date: Wed, 20 May 2009 15:24:12 -0300
  4. Subject: [PATCH] Use a specific script by suite for setting the password. This restores the compatibility with Lenny through lenny-support package (that will provide the lenny.sh script).
  5.  
  6. ---
  7. packages/user-setup/debian/changelog | 8 ++++++
  8. packages/user-setup/debian/user-setup-udeb.install | 1 +
  9. packages/user-setup/debian/user-setup.install | 1 +
  10. packages/user-setup/scripts/default.sh | 20 ++++++++++++++
  11. packages/user-setup/scripts/lenny.sh | 13 +++++++++
  12. packages/user-setup/user-setup-apply | 27 +++++--------------
  13. 6 files changed, 50 insertions(+), 20 deletions(-)
  14. create mode 100644 packages/user-setup/scripts/default.sh
  15. create mode 100644 packages/user-setup/scripts/lenny.sh
  16.  
  17. diff --git a/packages/user-setup/debian/changelog b/packages/user-setup/debian/changelog
  18. index 6330ce7..2d181ed 100644
  19. --- a/packages/user-setup/debian/changelog
  20. +++ b/packages/user-setup/debian/changelog
  21. @@ -1,3 +1,11 @@
  22. +user-setup (1.26) UNRELEASED; urgency=low
  23. +
  24. + * Use a specific script by suite for setting the password. This restores
  25. + the compatibility with Lenny through lenny-support package (that will
  26. + provide the lenny.sh script).
  27. +
  28. + -- Otavio Salvador <otavio@ossystems.com.br> Wed, 20 May 2009 15:22:25 -0300
  29. +
  30. user-setup (1.25) unstable; urgency=low
  31.  
  32. * Brown paper bag release
  33. diff --git a/packages/user-setup/debian/user-setup-udeb.install b/packages/user-setup/debian/user-setup-udeb.install
  34. index 29c7804..f351806 100644
  35. --- a/packages/user-setup/debian/user-setup-udeb.install
  36. +++ b/packages/user-setup/debian/user-setup-udeb.install
  37. @@ -1,6 +1,7 @@
  38. user-setup-ask usr/bin
  39. user-setup-apply usr/bin
  40. functions.sh usr/lib/user-setup
  41. +scripts usr/lib/user-setup
  42. reserved-usernames usr/lib/user-setup
  43. finish-install.d usr/lib
  44. pre-pkgsel.d usr/lib
  45. diff --git a/packages/user-setup/debian/user-setup.install b/packages/user-setup/debian/user-setup.install
  46. index 1014600..4a10db2 100644
  47. --- a/packages/user-setup/debian/user-setup.install
  48. +++ b/packages/user-setup/debian/user-setup.install
  49. @@ -2,4 +2,5 @@ user-setup usr/bin
  50. user-setup-ask usr/lib/user-setup
  51. user-setup-apply usr/lib/user-setup
  52. functions.sh usr/lib/user-setup
  53. +scripts usr/lib/user-setup
  54. reserved-usernames usr/lib/user-setup
  55. diff --git a/packages/user-setup/scripts/default.sh b/packages/user-setup/scripts/default.sh
  56. new file mode 100644
  57. index 0000000..6de3488
  58. --- /dev/null
  59. +++ b/packages/user-setup/scripts/default.sh
  60. @@ -0,0 +1,20 @@
  61. +# Set a password, via chpasswd.
  62. +# Use a heredoc rather than echo, to avoid the password
  63. +# showing in the process table. (However, this is normally
  64. +# only called when first installing the system, when root has no
  65. +# password at all, so that should be an unnecessary precaution).
  66. +#
  67. +# Pass in three arguments: the user, the password, and 'true' if the
  68. +# password has been pre-crypted (by preseeding).
  69. +setpassword () {
  70. + local USER PASSWD OPTS
  71. + USER="$1"
  72. + PASSWD="$2"
  73. + if [ "$3" = true ]; then
  74. + $chroot $ROOT usermod --password=$PASSWD $USER
  75. + else
  76. + $chroot $ROOT chpasswd $OPTS <<EOF
  77. +$USER:$PASSWD
  78. +EOF
  79. + fi
  80. +}
  81. diff --git a/packages/user-setup/scripts/lenny.sh b/packages/user-setup/scripts/lenny.sh
  82. new file mode 100644
  83. index 0000000..e3b9893
  84. --- /dev/null
  85. +++ b/packages/user-setup/scripts/lenny.sh
  86. @@ -0,0 +1,13 @@
  87. +setpassword () {
  88. + local USER PASSWD OPTS
  89. + USER="$1"
  90. + PASSWD="$2"
  91. + if [ "$3" = true ]; then
  92. + OPTS=-e
  93. + else
  94. + OPTS=-m
  95. + fi
  96. + $chroot $ROOT chpasswd $OPTS <<EOF
  97. +$USER:$PASSWD
  98. +EOF
  99. +}
  100. diff --git a/packages/user-setup/user-setup-apply b/packages/user-setup/user-setup-apply
  101. index 56b2357..0b3a4bf 100755
  102. --- a/packages/user-setup/user-setup-apply
  103. +++ b/packages/user-setup/user-setup-apply
  104. @@ -16,26 +16,13 @@ fi
  105.  
  106. . /usr/lib/user-setup/functions.sh
  107.  
  108. -# Set a password, via chpasswd.
  109. -# Use a heredoc rather than echo, to avoid the password
  110. -# showing in the process table. (However, this is normally
  111. -# only called when first installing the system, when root has no
  112. -# password at all, so that should be an unnecessary precaution).
  113. -#
  114. -# Pass in three arguments: the user, the password, and 'true' if the
  115. -# password has been pre-crypted (by preseeding).
  116. -setpassword () {
  117. - local USER PASSWD OPTS
  118. - USER="$1"
  119. - PASSWD="$2"
  120. - if [ "$3" = true ]; then
  121. - $chroot $ROOT usermod --password=$PASSWD $USER
  122. - else
  123. - $chroot $ROOT chpasswd $OPTS <<EOF
  124. -$USER:$PASSWD
  125. -EOF
  126. - fi
  127. -}
  128. +suite=default
  129. +db_get mirror/suite
  130. +if [ -n "$RET" ] && [ -e /usr/lib/user-setup/scripts/$RET.sh ]; then
  131. + suite="$RET"
  132. +fi
  133. +
  134. +. /usr/lib/user-setup/scripts/$suite.sh
  135.  
  136. # Enable/disable shadow passwords.
  137. db_get passwd/shadow
  138. --
  139. 1.6.3.1.54.g99dd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement