Permalink
Browse files

Add user-data script from Ntino for setting passwords from AWS consol…

…e; only install scripts and clean directories if is_ec2_image flag set
  • Loading branch information...
chapmanb committed May 25, 2011
1 parent c0a33d4 commit e8cc77323817ecfa97c0023514165153621d7877
Showing with 39 additions and 11 deletions.
  1. +3 −3 config/fabricrc.txt
  2. +6 −6 config/packages.yaml
  3. +7 −2 fabfile.py
  4. +23 −0 installed_files/K20userdatapassnx.sh
  5. 0 installed_files/setupnx.sh
View
@@ -15,9 +15,9 @@ dist_name = natty
#distribution = debian
#dist_name = squeeze
-# Whether to clean the system after finishing -- useful for preparing AMIs
-# but should not be run on vagrant or local machines
-do_final_cleanup = false
+# Whether to clean the system and install setup scripts after finishing
+# Useful for preparing AMI but should not be run on vagrant or local machines
+is_ec2_image = false
# Global installation directory for packages and standard programs
system_install = /usr
View
@@ -284,9 +284,9 @@ bio_alignment:
- probcons
- t-coffee
- bio-linux-seaview
- #- bio-linux-clustal
+ # Version problem - bio-linux-clustal
- bio-linux-dotter
- #- bio-linux-jalview
+ # Version problem - bio-linux-jalview
- bio-linux-pfaat
- bio-linux-prank
- bio-linux-squint
@@ -337,7 +337,7 @@ bio_utils:
- bio-linux-base-directories
- bio-linux-bldp-files
- bio-linux-sampledata
- #- bio-linux-sequin
+ # Version problem - bio-linux-sequin
- bio-linux-taxinspector
- bio-linux-themes-v5
phylogeny:
@@ -347,10 +347,10 @@ phylogeny:
- mrbayes
- njplot
- tree-puzzle
- #- bio-linux-arb
+ # Version problem - bio-linux-arb
- bio-linux-coalesce
- bio-linux-dendroscope
- - bio-linux-fastDNAml
+ # Version problem - bio-linux-fastDNAml
- bio-linux-fluctuate
- bio-linux-forester
- bio-linux-happy
@@ -363,7 +363,7 @@ phylogeny:
- bio-linux-qtlcart
- bio-linux-recombine
- bio-linux-splitstree
- - bio-linux-treeview
+ # Version problem - bio-linux-treeview
needs_64bit:
- bio-linux-fasttree
# To do -- in Deb Med but not propogated
View
@@ -302,8 +302,8 @@ def install_bare(packagelist='unknown_packagelist', flavor=None, target=None):
if target is None or target == "libraries":
_do_library_installs(lib_install)
if target is None or target == "finalize":
- _freenx_scripts()
- if env.do_final_cleanup.upper() in ["TRUE", "YES"]:
+ if env.has_key("is_ec2_image") and env.is_ec2_image.upper() in ["TRUE", "YES"]:
+ _freenx_scripts()
_cleanup()
@@ -704,6 +704,11 @@ def _freenx_scripts():
if not exists(remote_login):
put(os.path.join(install_file_dir, 'bash_login'), remote_login,
mode=0777)
+ userdata_script = "K20userdatapassnx.sh"
+ userdata_remote = "/etc/rc1.d/%s" % userdata_script
+ if not exists(userdata_remote):
+ put(os.path.join(install_file_dir, userdata_script), userdata_remote,
+ mode=0777, use_sudo=True)
def _cleanup():
"""Clean up any extra files after building.
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Check for passwords sent in via the user-data box in the AWS
+# console. This prevents ever needing to SSH into the instance
+# to allow connections via FreeNX directly.
+
+#get password from user data set in the AWS console
+PASSWD=`curl --connect-timeout 5 -s http://169.254.169.254/latest/user-data`
+
+if [[ ! -z "$PASSWD" ]]; then
+ if [[ "$PASSWD" != *'404 - Not Found'* ]]; then
+ echo "Setting ubuntu password from user-data"
+ #update the password for the ubuntu user
+ /usr/bin/autopasswd ubuntu $PASSWD >&/dev/null
+
+ #force SSH to allow password logins
+ sed -i 's/^PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config
+ /etc/init.d/ssh reload >&/dev/null
+
+ #set-up FreeNX
+ dpkg-reconfigure -pcritical freenx-server >&/dev/null
+ fi
+fi
View
0 installed_files/setupnx.sh 100644 → 100755
No changes.

0 comments on commit e8cc773

Please sign in to comment.