implemented pre-apt checks
[jelmer/etckeeper.git] / pre-apt.d / 50uncommitted-changes
1 #!/bin/sh
2 set -e
3 cd /etc
4 while git-status || ! LANG=C git-status 2>&1 | grep -q "working directory clean"
5 do
6         echo "etckeeper warning: /etc has uncommitted changes" >&2
7         printf "Press Enter to commit these changes and continue. "
8         read line
9         git add .
10         if ! git commit -m "saving uncommitted changes in /etc prior to apt run"; then
11                 echo "etckeeper warning: git commit failed" >&2
12                 echo "Please resolve the uncommitted changes by hand."
13                 printf "Press Enter when ready to continue. "
14                 read line
15         fi
16 done