Skip to content

Instantly share code, notes, and snippets.

@nekoya
Created May 28, 2009 07:14
Show Gist options
  • Save nekoya/119155 to your computer and use it in GitHub Desktop.
Save nekoya/119155 to your computer and use it in GitHub Desktop.
#!/bin/sh
ONFILE="/etc/yum.repos.d/dag.repo"
OFFFILE="/etc/yum.repos.d/dag"
usage() {
echo "Usage: dagrepos {on|off}"
echo -n " DAG repository:"
if [ -e $ONFILE ]; then
echo "ON"
elif [ -e $OFFFILE ]; then
echo "OFF"
else
echo "ERROR: no repository file"
fi
exit 1
}
if [ $1 ]
then
case "$1" in
on)
if [ -e $ONFILE ]; then
echo "DAG repository already ON"
elif [ -e $OFFFILE ]; then
sudo mv $OFFFILE $ONFILE
echo "DAG repository switched ON"
else
echo "ERROR: no repository file"
fi
;;
off)
if [ -e $OFFFILE ]; then
echo "DAG repository already OFF"
elif [ -e $ONFILE ]; then
sudo mv $ONFILE $OFFFILE
echo "DAG repository switched OFF"
else
echo "ERROR: no repository file"
fi
;;
*)
usage
esac
exit 0
else
usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment