Created
July 4, 2012 00:50
-
-
Save mguentner/3044427 to your computer and use it in GitHub Desktop.
An easy config manager for ethersex
This file contains hidden or 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 | |
# | |
# ceth - saves and restores ethersex config files | |
# License: GPL v3 or later, http://www.gnu.org/licenses/ | |
# Author: Maximilian Güntner <[email protected]> | |
# | |
# Version: v.1 - initial release | |
# | |
CONFIG=".config" | |
CONFIGDIR=".configs" | |
function usage { | |
echo "$0 COMMAND [ARGUMENTS]" | |
echo "Commands:" | |
echo "list - Lists all configuration files" | |
echo "restore CONFIG - Restores CONFIG to $CONFIG" | |
echo "save CONFIG - saves current $CONFIG as CONFIG" | |
} | |
if [ ! -d $CONFIGDIR ] | |
then | |
mkdir $CONFIGDIR | |
echo "$CONFIGDIR has been created" | |
fi | |
if [ "$1" = "restore" ] | |
then | |
if [ $# -ne 2 ] | |
then | |
echo "This command requires two arguments" | |
usage | |
exit 1 | |
fi | |
if [ -e $CONFIGDIR/$2 ] | |
then | |
cp $CONFIGDIR/$2 $CONFIG | |
/bin/echo -ne "\t\n\n" | make no_deps=t menuconfig | |
echo "$2 has been restored" | |
else | |
echo "This configuration does not exist" | |
exit 1 | |
fi | |
elif [ "$1" = "save" ] | |
then | |
if [ $# -ne 2 ] | |
then | |
echo "This command requires two arguments" | |
usage | |
exit 1 | |
fi | |
cp $CONFIG $CONFIGDIR/$2 | |
echo "$2 has been saved" | |
exit 0 | |
elif [ "$1" = "list" ] | |
then | |
ls $CONFIGDIR | |
else | |
usage | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment