improved rebuild script.
This commit is contained in:
44
rebuild.sh
44
rebuild.sh
@@ -6,17 +6,45 @@ set -e
|
|||||||
|
|
||||||
git_status="$(git status)"
|
git_status="$(git status)"
|
||||||
|
|
||||||
if $(echo "${git_status}" | grep "nothing to commit" &> /dev/null) ; then
|
if echo "${git_status}" | grep "nothing to commit"; then
|
||||||
echo "Nothing to commit."
|
#echo "Nothing to commit."
|
||||||
|
CAN_BUILD="Y"
|
||||||
|
:
|
||||||
|
|
||||||
else
|
elif echo "${git_status}" | grep "branch is ahead of 'origin/"; then
|
||||||
echo "buuuhuuu"
|
#echo "4"
|
||||||
|
CAN_BUILD="N"
|
||||||
|
:
|
||||||
|
|
||||||
|
elif echo "${git_status}" | grep "Changes not staged for commit"; then
|
||||||
|
#echo "There are changes not yet staged for commit."
|
||||||
|
CAN_BUILD="N"
|
||||||
|
:
|
||||||
|
|
||||||
|
elif echo "${git_status}" | grep "Changes to be committed"; then
|
||||||
|
#echo "There are changes not yet committed."
|
||||||
|
CAN_BUILD="N"
|
||||||
|
:
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "Copying configurations to etc and rebuilding."
|
function build {
|
||||||
#sudo cp /home/adam/nixos-configurations/*.nix /etc/nixos/.
|
echo "Copying configurations to etc and rebuilding."
|
||||||
|
#sudo cp /home/adam/nixos-configurations/*.nix /etc/nixos/.
|
||||||
|
|
||||||
echo "Rebuilding os..."
|
echo "Rebuilding os..."
|
||||||
#sudo nixos-rebuild switch
|
#sudo nixos-rebuild switch
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [[ CAN_BUILD != "Y" ]]; then
|
||||||
|
echo -e "\ngit not in sync with server, or has uncomitted changes?\nDo you want to continue?"
|
||||||
|
select yn in "Yes" "No"; do
|
||||||
|
case $yn in
|
||||||
|
Yes ) build;;
|
||||||
|
No ) exit;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user