Skip to content

Instantly share code, notes, and snippets.

@ryancragun
Created August 29, 2013 18:12
Show Gist options
  • Save ryancragun/6381451 to your computer and use it in GitHub Desktop.
Save ryancragun/6381451 to your computer and use it in GitHub Desktop.
Create monolithic chef repo that mirrors previous repo path overrides
#!/usr/bin/env bash
# Create monolithic git repo that mirrors previous override structure
#create temp dir
temp_dir=/tmp/chef
mkdir $temp_dir
cd $temp_dir
#check out cookbooks
git clone https://github.com/rightscale/rightscale_cookbooks rightscale_cookbooks_upstream
git clone https://github.com/rightscale/cookbooks.git cookbooks_upstream
git clone [email protected]:tmngo/chef_cookbook_tmngo.git tmngo
#checkout the proper branches
cd rightscale_cookbooks_upstream
git checkout release_12H1
cd ../cookbooks_upstream
git checkout release_12H1
cd ../tmngo
git checkout stage_config
#create our staging directory
mkdir -p ../repo_stage/cookbooks
cd $temp_dir
#merge cookbooks into staging directory
rsync -avz --exclude '.git/*' cookbooks_upstream/ repo_stage/cookbooks/
rsync -avz --exclude '.git/*' rightscale_cookbooks_upstream/cookbooks/ repo_stage/cookbooks/
rsync -avz --exclude '.git/*' tmngo/cookbooks/ repo_stage/cookbooks/
#merge staging repo into a new 'rightscale' branch
cd ./tmngo
git checkout -b rightscale stage_config
rsync -avz --exclude '.git/*' $temp_dir/repo_stage/ ./
git add .
git commit -am "Added rightscale/cookbooks and rightscale/rightscale_cookbooks to chef repo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment