Move long commands from dotbot config into scripts
Move long commands from the dotbot config into own scripts to keep the install.conf.yaml more readable. Fix bug that the submodule init step fails when already done once since then the grep statement fails because there is no output.
This commit is contained in:
20
meta/archive
Normal file
20
meta/archive
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
tmpd="$(mktemp -d)"
|
||||
|
||||
for file in .config/*; do
|
||||
[ ! -e "$HOME/$file" ] || mv "$HOME/$file" "$tmpd"
|
||||
done
|
||||
|
||||
if rmdir "$tmpd" 2>/dev/null; then
|
||||
echo "Nothing to archive"
|
||||
else
|
||||
name="existing-$(date +"%s").tar.gz"
|
||||
if tar czvf "$name" "$tmpd"; then
|
||||
rm -rf "$tmpd"
|
||||
echo "$name created"
|
||||
else
|
||||
echo "Archive could not be created. See $tmpd."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user