Merge lp:~xnox/charms/precise/sbuild/add-more-options into lp:charms/sbuild

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 5
Proposed branch: lp:~xnox/charms/precise/sbuild/add-more-options
Merge into: lp:charms/sbuild
Diff against target: 157 lines (+51/-19)
4 files modified
config.yaml (+16/-0)
hooks/config-changed (+17/-3)
hooks/install (+17/-15)
revision (+1/-1)
To merge this branch: bzr merge lp:~xnox/charms/precise/sbuild/add-more-options
Reviewer Review Type Date Requested Status
Juan L. Negron (community) Approve
Review via email: mp+135099@code.launchpad.net

Description of the change

  * make btsparty an option (to have unattended sbuilds)
  * add $HOME option (set to /mnt, as that's where most clouds give space)
  * add .mk-sbuild.rc & .mk-sbuild.sources (for mk-sbuild integration)

To post a comment you must log in.
Revision history for this message
Juan L. Negron (negronjl) wrote :

Hi Dmitrijs:

Thank you for the extra options in the charm.

This looks good to me and, it doesn't seem to be breaking anything.

Approved.

Merged.

Thanks,

Juan

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2012-06-18 16:15:49 +0000
+++ config.yaml 2012-11-20 10:18:32 +0000
@@ -3,11 +3,19 @@
3 type: string3 type: string
4 default: builder4 default: builder
5 description: The name of the account that performs builds.5 description: The name of the account that performs builds.
6 home:
7 type: string
8 default: /home
9 description: The home directory location for the above account.
6 salt:10 salt:
7 type: string11 type: string
8 default: unset12 default: unset
9 description: Salt for generating builder accounts.13 description: Salt for generating builder accounts.
10 validator: '.{8,}'14 validator: '.{8,}'
15 btsparty:
16 type: boolean
17 default: yes
18 description: Setup accounts for public access.
11 chroots:19 chroots:
12 type: string20 type: string
13 default: ubuntu:quantal21 default: ubuntu:quantal
@@ -16,3 +24,11 @@
16 type: string24 type: string
17 default: ""25 default: ""
18 description: Comma-separated list of extra packages to install in chroots.26 description: Comma-separated list of extra packages to install in chroots.
27 mk-sbuild.rc:
28 type: string
29 default: ""
30 description: Contents of mk-sbuild.rc. See $ man mk-sbuild.
31 mk-sbuild.sources:
32 type: string
33 default: ""
34 descption: Conternts of ~/.mk-sbuild.sources. See $ man mk-sbuild.
1935
=== modified file 'hooks/config-changed'
--- hooks/config-changed 2012-06-18 16:15:49 +0000
+++ hooks/config-changed 2012-11-20 10:18:32 +0000
@@ -3,16 +3,30 @@
33
4USERNAME=$(config-get username)4USERNAME=$(config-get username)
5SALT=$(config-get salt)5SALT=$(config-get salt)
6BTSPARTY=$(config-get btsparty)
67
7password=$(echo "$SALT:$JUJU_UNIT_NAME" | md5sum - | cut -c-12)8if [ "$BTSPARTY" = "yes" ]; then
8juju-log "On $JUJU_UNIT_NAME $USERNAME password is '$password'"9 password=$(echo "$SALT:$JUJU_UNIT_NAME" | md5sum - | cut -c-12)
9echo "$USERNAME:$password" | chpasswd10 juju-log "On $JUJU_UNIT_NAME $USERNAME password is '$password'"
11 echo "$USERNAME:$password" | chpasswd
12fi
1013
11CHROOTS=$(config-get chroots)14CHROOTS=$(config-get chroots)
12PACKAGES=$(config-get packages)15PACKAGES=$(config-get packages)
16MK_SBUILD_RC=$(config-get mk-sbuild.rc)
17MK_SBUILD_SOURCES=$(config-get mk-sbuild.sources)
18HOMEDIR=$(getent passwd $USERNAME | cut -d: -f 6)
13if [ -n "$PACKAGES" ]; then19if [ -n "$PACKAGES" ]; then
14 PACKAGES="--debootstrap-include=$PACKAGES"20 PACKAGES="--debootstrap-include=$PACKAGES"
15fi21fi
22if [ -n "$MK_SBUILD_RC" ]; then
23 config-get mk-sbuild.rc -o $HOMEDIR/.mk-sbuild.rc
24 chown $USERNAME $HOMEDIR/.mk-sbuild.rc
25fi
26if [ -n "$MK_SBUILD_SOURCES" ]; then
27 config-get mk-sbuild.rc -o $HOMEDIR/.mk-sbuild.sources
28 chown $USERNAME $HOMEDIR/.mk-sbuild.sources
29fi
1630
17ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)31ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
18arches=$ARCH32arches=$ARCH
1933
=== modified file 'hooks/install'
--- hooks/install 2012-06-18 23:28:51 +0000
+++ hooks/install 2012-11-20 10:18:32 +0000
@@ -2,9 +2,11 @@
2set -ex2set -ex
33
4USERNAME=$(config-get username)4USERNAME=$(config-get username)
5HOMEDIR=$(config-get home)
5DISTRO=$(config-get distro)6DISTRO=$(config-get distro)
6RELEASES=$(config-get releases)7RELEASES=$(config-get releases)
7SALT=$(config-get salt)8SALT=$(config-get salt)
9BTSPARTY=$(config-get btsparty)
810
9echo set debconf/frontend Noninteractive | debconf-communicate11echo set debconf/frontend Noninteractive | debconf-communicate
10echo set debconf/priority critical | debconf-communicate12echo set debconf/priority critical | debconf-communicate
@@ -13,24 +15,16 @@
1315
14apt-get dist-upgrade -y16apt-get dist-upgrade -y
1517
16apt-get install -y build-essential devscripts ubuntu-dev-tools sbuild schroot debootstrap rng-tools </dev/null18apt-get install -y build-essential devscripts ubuntu-dev-tools sbuild schroot debootstrap haveged </dev/null
1719
18# Fix up weird issue with debootstrap leaving system in uninstallable state20# Fix up weird issue with debootstrap leaving system in uninstallable state
19perl -pi -e 's/^# Pull down signature requirements/apt-get -f install -y --force-yes\n# Pull down signature requirements/' /usr/bin/mk-sbuild21perl -pi -e 's/^# Pull down signature requirements/apt-get -f install -y --force-yes\n# Pull down signature requirements/' /usr/bin/mk-sbuild
2022
21passwd -l ubuntu
22if grep -q '^PasswordAuthentication no' /etc/ssh/sshd_config; then
23 perl -pi -e 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
24 service ssh restart
25fi
26if ! getent passwd $USERNAME >/dev/null; then23if ! getent passwd $USERNAME >/dev/null; then
27 adduser --quiet --disabled-password --ingroup users \24 adduser --quiet --disabled-password --ingroup users \
28 --gecos "Build User" \25 --gecos "Build User" \
29 --home /home/$USERNAME $USERNAME26 --home $HOMEDIR/$USERNAME $USERNAME
30fi27fi
31password=$(echo "$SALT:$JUJU_UNIT_NAME" | md5sum - | cut -c-12)
32juju-log "On $JUJU_UNIT_NAME $USERNAME password is '$password'"
33echo "$USERNAME:$password" | chpasswd
3428
35cat >/etc/sudoers.d/60-sbuild <<EOM29cat >/etc/sudoers.d/60-sbuild <<EOM
36$USERNAME ALL=(ALL) NOPASSWD:ALL30$USERNAME ALL=(ALL) NOPASSWD:ALL
@@ -41,13 +35,20 @@
41if ! getent group sbuild | grep -q $USERNAME; then35if ! getent group sbuild | grep -q $USERNAME; then
42 # No-op to set up mk-sbuild environment.36 # No-op to set up mk-sbuild environment.
43 EDITOR=cat su -c "/usr/bin/mk-sbuild invalid-release" $USERNAME37 EDITOR=cat su -c "/usr/bin/mk-sbuild invalid-release" $USERNAME
44 # Terrible hack to gain entropy and generate builder keys for sbuild.
45 rngd -r /dev/urandom
46 su -c "sbuild-update --keygen" $USERNAME38 su -c "sbuild-update --keygen" $USERNAME
47fi39fi
4840
49rm -f /etc/update-motd.d/98-cloudguest41if [ "$BTSPARTY" = "yes" ]; then
50cat >/etc/update-motd.d/98-sbuild <<EOM42 passwd -l ubuntu
43 if grep -q '^PasswordAuthentication no' /etc/ssh/sshd_config; then
44 perl -pi -e 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
45 service ssh restart
46 fi
47 password=$(echo "$SALT:$JUJU_UNIT_NAME" | md5sum - | cut -c-12)
48 juju-log "On $JUJU_UNIT_NAME $USERNAME password is '$password'"
49 echo "$USERNAME:$password" | chpasswd
50 rm -f /etc/update-motd.d/98-cloudguest
51 cat >/etc/update-motd.d/98-sbuild <<EOM
51#!/bin/bash52#!/bin/bash
52echo ""53echo ""
53echo "###################################################################"54echo "###################################################################"
@@ -58,6 +59,7 @@
58echo "# #"59echo "# #"
59echo "###################################################################"60echo "###################################################################"
60EOM61EOM
61chmod a+rx /etc/update-motd.d/98-sbuild62 chmod a+rx /etc/update-motd.d/98-sbuild
63fi
6264
63exit 065exit 0
6466
=== modified file 'revision'
--- revision 2012-06-18 16:15:49 +0000
+++ revision 2012-11-20 10:18:32 +0000
@@ -1,1 +1,1 @@
122124

Subscribers

People subscribed via source and target branches

to all changes: