ó FRTc@s{ddlZddlZddlZddlZddlZddlZddlmZdejj j fd„ƒYZ dS(iĸĸĸĸN(tgetpwnamt InstallercBsbeZdZddddddd d„Zd„Zd„Zd„Zd„Zd„Z d „Z RS( s5 Base Installer class for Ubuntu-based AMI's t*trootc CsĖ|dkr$ttjdƒƒ}n|dkrHttjdƒƒ}ntd|dƒ} | r˜x4| jƒD]#\} } | jd| | fƒqnWn| jd|||||||fƒ| jƒdS( sÐ Write a file to /etc/cron.d to schedule a command env is a dict containing environment variables you want to set in the file name will be used as the name of the file trandomi<is/etc/cron.d/%stws%s=%s s%s %s %s %s %s %s %s N(tstrRt randrangetopentitemstwritetclose( tselftnametcommandtminutethourtmdaytmonthtwdaytwhotenvtfptkeytvalue((sS/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/installer.pytadd_cron"s  &cCsqtjjd|ƒ}t|dƒ}|j|ƒ|jƒtj|tjtj Btj Bƒ|j d|ƒdS(s7 Add this file to the init.d directory s /etc/init.dRs!/usr/sbin/update-rc.d %s defaultsN( tostpathtjoinRR R tchmodtstattS_IREADtS_IWRITEtS_IEXECtrun(R tfileR tf_pathtf((sS/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/installer.pytadd_init_script3s   !cCs‰tjjd||fƒtjjdƒsH|jddtdtƒntddƒ}|j d||fƒ|j ƒ|tj |s cCs|jd|ƒdS(Ns/etc/init.d/%s stop(R"(R t service_name((sS/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/installer.pytstopLscCs|jd|ƒdS(Ns/etc/init.d/%s start(R"(R R1((sS/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/installer.pytstartOscCs!|jd|ƒt|ƒ}|S(s3 Create a user on the local system s useradd -m %s(R"R(R tusertusr((sS/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/installer.pyt create_userRs cCs t‚dS(s> This is the only method you need to override N(tNotImplementedError(R ((sS/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/installer.pytinstallZsN( t__name__t __module__t__doc__tNoneRR&R0R2R3R6R8(((sS/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/installer.pyRs    ( tboto.pyami.installersR*Rtos.pathRRtpwdRtpyamit installersR(((sS/opt/freeware/lib/python2.7/site-packages/boto/pyami/installers/ubuntu/installer.pyts