diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-09-01 23:26:20 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-09-01 23:26:20 -0300 |
commit | f81237f1f34b67b4862c734ba71183ae57be8ba2 (patch) | |
tree | e79c0e43d43b4be4426e25fd1e758090d35c1764 /share | |
parent | 18d9db346a2a5ebeeebc8f4294f0d1e35091007b (diff) | |
download | hydra-f81237f1f34b67b4862c734ba71183ae57be8ba2.tar.gz hydra-f81237f1f34b67b4862c734ba71183ae57be8ba2.tar.bz2 |
Bootless: switching to git-annex
Diffstat (limited to 'share')
-rwxr-xr-x | share/hydra/bootless | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/share/hydra/bootless b/share/hydra/bootless index 8601ddd..5b5300c 100755 --- a/share/hydra/bootless +++ b/share/hydra/bootless @@ -31,6 +31,15 @@ function hydra_bootless_folder { fi } +# Sync bootless folder +function hydra_bootless_rsync { + # Exclude git folder and follow git-annex symlinks + $sudo rsync -CLavz --exclude boot $1/ $2/ + + # Make sure there's a symlink to itself + ( cd $2 && ln -s . boot ) +} + # Make a boot device function hydra_bootless_make { # Set folder @@ -96,13 +105,23 @@ EOF # Copy data if [ "$rsync" == "true" ]; then - $sudo rsync -Cav ${BOOTLESS_DIR}/ ${tmpdir}/boot/ + hydra_bootless_rsync ${BOOTLESS_DIR} ${tmpdir}/boot else - $sudo git clone --depth=1 file:///${BOOTLESS_DIR} ${tmpdir}/boot + #$sudo git clone --depth=1 file:///${BOOTLESS_DIR} ${tmpdir}/boot + $sudo git clone file:///${BOOTLESS_DIR} ${tmpdir}/boot if [ $? != 0 ]; then echo "Error: failed to clone repository \"${BOOTLESS_DIR}\" in \"${tmpdir}\" (errno: $?)." exit 1 fi + + ( + cd ${tmpdir}/boot && git annex init && git annex untrust here && git annex sync && git annex get . + ) + + if [ $? != 0 ]; then + echo "Error: failed to get files into repository \"${BOOTLESS_DIR}\" in \"${tmpdir}\" (errno: $?)." + exit 1 + fi fi # Grub legacy @@ -171,9 +190,10 @@ function hydra_bootless_update { # Copy data if [ -d "${tmpdir}/boot/.git" ]; then - ( cd ${tmpdir}/boot && $sudo git pull origin master ) + #( cd ${tmpdir}/boot && $sudo git pull origin master ) + ( cd ${tmpdir}/boot && $sudo git annex sync && git annex get . ) else - $sudo rsync -Cav ${BOOTLESS_DIR}/ ${tmpdir}/boot/ + hydra_bootless_rsync ${BOOTLESS_DIR} ${tmpdir}/boot fi # Finalize @@ -187,13 +207,16 @@ function hydra_bootless_init { if [ ! -z "$1" ]; then # Clone from url - git clone $1 $HYDRA_FOLDER/bootless + git clone $1 $HYDRA_FOLDER/bootless && + ( cd $HYDRA_FOLDER/bootless && git annex init && git annex sync ) exit $? fi # Create a fresh repository mkdir -p $HYDRA_FOLDER/bootless/{default,custom,grub} mkdir -p $HYDRA_FOLDER/bootless/default/{debian,memtest,ubuntu} + touch $HYDRA_FOLDER/bootless/{default,custom,grub}/.empty + touch $HYDRA_FOLDER/bootless/default/{debian,memtest,ubuntu}/.empty ( cd $HYDRA_FOLDER/bootless && ln -s . boot) if [ -f "/boot/memtest86+.bin" ]; then @@ -243,7 +266,12 @@ EOF ( cd $HYDRA_FOLDER/bootless git init - git add . + git annex init + git add boot + git add {default,custom,grub}/.empty + git add default/{debian,memtest,ubuntu}/.empty + git add grub/grub.cfg + git annex add . git commit -a -m "Initial import" ) @@ -345,7 +373,7 @@ function hydra_bootless_image { # Copy data tmpdir=`mktemp -d` - $sudo rsync -Cav ${BOOTLESS_DIR}/ ${tmpdir}/boot/ + hydra_bootless_rsync ${BOOTLESS_DIR} ${tmpdir}/boot # Make rescue disk grub-mkrescue -o ${output} ${tmpdir} @@ -390,7 +418,7 @@ function hydra_bootless_usage { } # Check for requirements -for req in parted; do +for req in parted git-annex; do hydra_install_package $req done |