add git migration to convert tarball sourced dotfiles into regular git
This commit is contained in:
parent
023d74d9df
commit
7389489a55
1 changed files with 8 additions and 1 deletions
|
@ -3,10 +3,11 @@
|
||||||
# curl https://raw.github.com/Klowner/dotfiles/main/bin/dotfiles | bash
|
# curl https://raw.github.com/Klowner/dotfiles/main/bin/dotfiles | bash
|
||||||
basedir="${DOTFILES_ROOT:-$HOME/.dotfiles}"
|
basedir="${DOTFILES_ROOT:-$HOME/.dotfiles}"
|
||||||
bindir="${DOTFILES_BIN:-$HOME/bin}"
|
bindir="${DOTFILES_BIN:-$HOME/bin}"
|
||||||
|
branch="${DOTFILES_BRANCH:-main}"
|
||||||
repo="Klowner/dotfiles"
|
repo="Klowner/dotfiles"
|
||||||
gitbase="git://github.com/${repo}.git"
|
gitbase="git://github.com/${repo}.git"
|
||||||
gitremote="git@github.com:${repo}"
|
gitremote="git@github.com:${repo}"
|
||||||
tarball="http://github.com/${repo}/tarball/master"
|
tarball="http://github.com/${repo}/tarball/${branch}"
|
||||||
|
|
||||||
function has() {
|
function has() {
|
||||||
return $(which $1 &> /dev/null)
|
return $(which $1 &> /dev/null)
|
||||||
|
@ -127,6 +128,12 @@ function git_migrate() {
|
||||||
if missing git; then
|
if missing git; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
if [ ! -d "${basedir}/.git" ]; then
|
||||||
|
note "Migrating dotfiles to git repository..."
|
||||||
|
git clone $gitremote --no-checkout --branch ${branch} "${basedir}/migrate"
|
||||||
|
git mv "${basedir}/migrate/.git" "${basedir}/.git"
|
||||||
|
rm -rf "${basedir}/migrate"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function add() {
|
function add() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue