From f19838091c1b689c7abfdf779ea6679fe2e59d45 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Wed, 16 Mar 2011 23:01:14 -0600 Subject: [PATCH] Added `wizard`, for creating local Auto config directories. --- NEWS | 3 ++- bin/wizard | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/CHANGELOG | 1 + install | 5 ++++- 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100755 bin/wizard diff --git a/NEWS b/NEWS index 72a4e0b..8f9de2e 100644 --- a/NEWS +++ b/NEWS @@ -13,9 +13,10 @@ the popular Auto IRC bot. In this alpha8 release, we have added: -* A module to get information on a package in AUR. +* A module to get information on a package in AUR (AUR). * Support for installs to custom locations. * Support for system-wide installs. (/usr or /usr/local) +* The `wizard` utility, for creating local Auto config directories. Bug fixes: diff --git a/bin/wizard b/bin/wizard new file mode 100755 index 0000000..fd35cb5 --- /dev/null +++ b/bin/wizard @@ -0,0 +1,53 @@ +#!/usr/bin/env perl +# bin/wizard - Wizard for creating local Auto configuration directories. +# Copyright (C) 2010-2011 Xelhua Development Group, et al. +# This program is free software; rights to this code are stated in doc/LICENSE. +use 5.010_000; +use strict; +use warnings; +use Cwd; +use FindBin qw($Bin); +use File::Copy; +our $VERSION = 1.00; +my $Bin = $Bin; + +# Get current working directory. +my $cwd = getcwd(); + +# One argument required. +if (!defined $ARGV[0]) { + say 'ERROR: Missing arguments.'; + say 'Usage: auto-wizard '; + exit; +} + +# Strip trailing slash. +my $installdir = $ARGV[0]; +$installdir =~ s/\/$//xsm; + +# Create missing directories. +if (!-d "$cwd/$installdir") { mkdir "$cwd/$installdir" } +if (!-d "$cwd/$installdir/etc") { mkdir "$cwd/$installdir/etc" } +if (!-d "$cwd/$installdir/var") { mkdir "$cwd/$installdir/var" } + +# Copy over example.conf. +copy("$Bin/../lib/autobot/3.0.0/dist/example.conf", "$cwd/$installdir/etc/example.conf"); +chmod 0644, "$cwd/$installdir/etc/example.conf"; + +# Our work is done. +print <<"MSG"; +Successfully installed to "$cwd/$installdir"! + +I've also created an example.conf for you and left it in etc/, configure it and +rename it to auto.conf or any name of your choice. + +See the Xelhua Wiki at http://wiki.xelhua.org for complete documentation. + +After that, change directory to "$cwd/$installdir" and run `$Bin/auto` (or if +"$Bin" is in your PATH; just `auto`). + +If you gave your config file a name other than auto.conf, pass -c=FILENAME to +`auto`, like so, if your config is etc/foo.conf: $Bin/auto -c=foo.conf + +Enjoy. +MSG diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 5fa757e..080925d 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Added `wizard`, for creating local Auto config directories. * Made Auto respond properly to PRIVMSGs received before connection. * Fixed an exploit in QDB that allowed users to use services fantasy commands with the bot's account. diff --git a/install b/install index 242cbf6..a37a504 100755 --- a/install +++ b/install @@ -191,14 +191,17 @@ if ($upref) { my $bgenssl = 'genssl'; my $bbuildmod = 'buildmod'; + my $bwizard = 'wizard'; if ($libbuild) { $bgenssl = "auto-$bgenssl"; $bbuildmod = "auto-$bbuildmod"; + $bwizard = "auto-$bwizard"; } copy("$Bin/bin/auto", "$PREFIX/bin/auto"); copy("$Bin/bin/buildmod", "$PREFIX/bin/$bbuildmod"); copy("$Bin/bin/genssl", "$PREFIX/bin/$bgenssl"); - chmod 0755, "$PREFIX/bin/auto", "$PREFIX/bin/$bgenssl", "$PREFIX/bin/$bbuildmod"; + copy("$Bin/bin/wizard", "$PREFIX/bin/$bwizard"); + chmod 0755, "$PREFIX/bin/auto", "$PREFIX/bin/$bgenssl", "$PREFIX/bin/$bbuildmod", "$PREFIX/bin/$bwizard"; rcopy("$Bin/lib/*", "$libdir/"); rcopy("$Bin/lang/*", "$langdir/"); rcopy("$Bin/modules/*", "$moddir/");