New and improved rebuild.sh
With prompt.
This commit is contained in:
47
rebuild.sh
47
rebuild.sh
@@ -4,47 +4,26 @@ set -e
|
|||||||
|
|
||||||
#git commit
|
#git commit
|
||||||
|
|
||||||
git_status="$(git status)"
|
git status
|
||||||
|
|
||||||
if echo "${git_status}" | grep "nothing to commit"; then
|
|
||||||
#echo "Nothing to commit."
|
|
||||||
CAN_BUILD="Y"
|
|
||||||
:
|
|
||||||
|
|
||||||
elif echo "${git_status}" | grep "branch is ahead of 'origin/"; then
|
|
||||||
#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
|
|
||||||
|
|
||||||
|
|
||||||
function build {
|
function build {
|
||||||
echo "Copying configurations to etc and rebuilding."
|
echo "Copying configurations to etc and rebuilding."
|
||||||
#sudo cp /home/adam/nixos-configurations/*.nix /etc/nixos/.
|
#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
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ CAN_BUILD != "Y" ]]; then
|
echo -e "\nDo you want to continue?"
|
||||||
echo -e "\ngit not in sync with server, or has uncomitted changes?\nDo you want to continue?"
|
select yn in "Build" "Build and Upgrade" "Commit" "Exit"; do
|
||||||
select yn in "Yes" "No"; do
|
case $yn in
|
||||||
case $yn in
|
Build ) build;;
|
||||||
Yes ) build;;
|
"Build and Upgrade" ) build --upgrade;;
|
||||||
No ) exit;;
|
Commit ) git commit -a;;
|
||||||
esac
|
Exit ) exit;;
|
||||||
done
|
esac
|
||||||
fi
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user