Created
May 28, 2009 07:14
-
-
Save nekoya/119155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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