Skip to content

Commit

Permalink
Added a hooks that stores/preserves the machine-id for your system.
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldotknopf committed Dec 15, 2018
1 parent 342acad commit 3d362b4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ install:
@install -D -m 755 scripts/hooks/hostname $(DESTDIR)/etc/darch/hooks/hostname/hook
@echo "installing /etc/darch/hooks/ssh/hook"
@install -D -m 755 scripts/hooks/ssh $(DESTDIR)/etc/darch/hooks/ssh/hook
@echo "installing /etc/darch/hooks/machine-id/hook"
@install -D -m 755 scripts/hooks/machine-id $(DESTDIR)/etc/darch/hooks/machine-id/hook
@echo "installing /etc/grub.d/60_darch"
@install -D -m 755 scripts/grub-mkconfig-script $(DESTDIR)/etc/grub.d/60_darch
clean_bundle:
Expand Down
26 changes: 26 additions & 0 deletions scripts/hooks/machine-id
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env sh
set -e

help() {
echo "Help..."
}

install() {
# Let's copy our a machine-id if we
# haven't currently stored it.
if [ ! -e /etc/darch/hooks/current-machine-id ]; then
if [ -e /etc/machine-id ]; then
cp /etc/machine-id /etc/darch/hooks/current-machine-id
fi
fi

cp /etc/darch/hooks/current-machine-id . || true
}

run() {
if [ -e "$DARCH_HOOK_DIR/current-machine-id" ]; then
rm -f "$DARCH_ROOT_FS/etc/machine-id"
mkdir -p "$DARCH_ROOT_FS/etc" || true
cp "$DARCH_HOOK_DIR/current-machine-id" "$DARCH_ROOT_FS/etc/machine-id"
fi
}

0 comments on commit 3d362b4

Please sign in to comment.
  NODES
COMMUNITY 1
Note 1
Project 3
USERS 1