diff options
author | Daniel Friesel <derf@finalrewind.org> | 2010-10-17 21:49:01 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2010-10-17 21:49:01 +0200 |
commit | 80dff8aecba5360e126123c87c4bbf318045ddc6 (patch) | |
tree | 9db199e5195267299655b94cd22b892b2ae32f0e /bin | |
parent | 75633f0c00af73c9324c1a58e57474312cfd479a (diff) |
"ct new": Additional arguments specify files to move into new package (experimental)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ct | 44 |
1 files changed, 36 insertions, 8 deletions
@@ -251,7 +251,6 @@ function vcs_new ( mkdir ${PKG_DIR}/${1} cd ${PKG_DIR}/${1} || die "Cannot cd to new package ${1}" git init - mkdir etc git remote add origin ${PKG_PROTO}://${PKG_UAH}/${PKG_PATH}/${1} ) @@ -859,23 +858,52 @@ function pkg_log { function pkg_new { - if [[ -z ${1} ]] { + package=${1} + pd=${PKG_DIR}/${package} + + if [[ -z ${package} ]] { die "Usage: ct new <packagename>\n" } - if list_exists ${1}; then - die "We already have a package with this name: ${1}\n" + shift + + if list_exists ${package}; then + die "We already have a package with this name: ${package}\n" fi pkgroot_setup ${PKG_ROOTS[1]} info "Creating local package...\n" - vcs_new ${1} + vcs_new ${package} if [[ ${PKG_PROTO} == ssh ]] { - info "Creating remote packages...\n" - ssh ${PKG_UAH} "GIT_DIR=${PKG_PATH}/${1} git --bare init" - say "Note that you will have to push manually the first time\n" + info "Creating remote package...\n" + ssh ${PKG_UAH} "GIT_DIR=${PKG_PATH}/${package} git --bare init" + } + + for file in ${*}; { + + if [[ ${file} != /* ]] { + file=${HOME}/${file} + } + + if [[ -x ${file} ]]; then + + mkdir -p ${pd}/bin + mv -i ${file} ${pd}/bin && \ + info "OK ${file} -> ${pd}/bin/${file:r}\n" + + elif [[ ! -d ${file} && ${file} =~ ${HOME}/'[^/]+$' ]]; then + + mkdir -p ${pd}/etc + mv -i ${file} ${pd}/etc/${file#${HOME}/.} && \ + info "OK ${file} -> ${pd}/etc/${file#${HOME}/.}\n" + + else + + say "Cannot handle ${file}" + + fi } } |