summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydra/bootless44
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