Changeset 497
- Timestamp:
- 06/16/08 14:58:30 (5 months ago)
- Files:
-
- trunk/lib/deprec/recipes.rb (modified) (1 diff)
- trunk/lib/deprec/recipes/git.rb (modified) (5 diffs)
- trunk/lib/deprec/recipes/gitosis.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/deprec/recipes.rb
r495 r497 32 32 require "#{File.dirname(__FILE__)}/recipes/utils" 33 33 require "#{File.dirname(__FILE__)}/recipes/git" 34 require "#{File.dirname(__FILE__)}/recipes/gitosis" trunk/lib/deprec/recipes/git.rb
r495 r497 28 28 deprec2.download_src(SRC_PACKAGES[:git], src_dir) 29 29 deprec2.install_from_src(SRC_PACKAGES[:git], src_dir) 30 create_git_root31 create_git_user30 # create_git_root 31 # create_git_user 32 32 end 33 33 … … 36 36 apt.install( {:base => %w(zlib1g-dev gettext)}, :stable ) 37 37 end 38 39 40 38 41 39 desc "Grant user ssh access to git" … … 95 93 96 94 task :create_remote do 95 96 # Create local git repo if missing 97 97 if ! File.directory?('.git') 98 98 system('git init') … … 101 101 system("git add . && git commit -m 'initial import'") 102 102 end 103 tempfile = "/tmp/#{application}.git" 104 destination = "#{git_root}/#{application}" 105 sudo "test -d #{tempfile} && mv /tmp/#{application}.git /tmp/#{application}.git-old; exit 0" 106 upload ".git", tempfile 107 sudo "mv #{tempfile} #{destination}" 108 sudo "chown -R #{git_user}.#{git_group} #{destination}" 103 104 # Push to remote git repo 109 105 hostname = capture "echo $CAPISTRANO:HOST$" 106 system "git remote add origin git@#{hostname.chomp}:#{application}" 107 system "git push origin master:refs/heads/master" 108 110 109 puts 111 puts "New remote Git repo: #{git_user}@#{hostname.chomp}:#{destination}" 112 puts 110 puts "New remote Git repo: #{git_user}@#{hostname.chomp}:#{application}" 111 puts 112 113 # Probably want to add this to .git/config 114 # 115 puts 'Add the following to .git/config' 116 puts '[branch "master"]' 117 puts ' remote = origin' 118 puts ' merge = refs/heads/master' 119 113 120 end 114 121 … … 139 146 end 140 147 141 task :create_git_user do142 deprec2.groupadd(git_group)143 deprec2.useradd(git_user, :group => git_group, :shell => '/usr/local/bin/git-shell')144 # Set the primary group for the git user (in case user already existed145 # when previous command was run)146 sudo "usermod --gid #{git_group} #{git_user}"147 sudo "passwd --unlock #{git_user}"148 end148 # task :create_git_user do 149 # deprec2.groupadd(git_group) 150 # deprec2.useradd(git_user, :group => git_group, :shell => '/usr/local/bin/git-shell') 151 # # Set the primary group for the git user (in case user already existed 152 # # when previous command was run) 153 # sudo "usermod --gid #{git_group} #{git_user}" 154 # sudo "passwd --unlock #{git_user}" 155 # end 149 156 150 157 # regenerate git authorized keys file from users file in same dir
