Commit 141bb385 authored by Vitaly Lipatov's avatar Vitaly Lipatov

initial commit

parents
This diff is collapsed. Click to expand it.
pkgdatadir=$(datadir)/erc
# due using %makeinstallstd in spec
instpkgdatadir=/usr/share/erc
install:
mkdir -p $(DESTDIR)$(bindir)/
# breaks link
#install -m 755 `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/
cp -a `ls -1 bin/* | grep -v "-"` $(DESTDIR)$(bindir)/
chmod 0755 $(DESTDIR)$(bindir)/*
# hack to replace path
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/erc >$(DESTDIR)$(bindir)/erc
sed -e "s|SHAREDIR=.*|SHAREDIR=$(instpkgdatadir)|g" -e "s|@VERSION@|$(version)|g" <bin/ercat >$(DESTDIR)$(bindir)/ercat
mkdir -p $(DESTDIR)$(pkgdatadir)/
install -m 644 `ls -1 bin/* | grep "-"` $(DESTDIR)$(pkgdatadir)/
mkdir -p $(DESTDIR)$(mandir)/man8
cp -a `ls -1 man/*` $(DESTDIR)$(mandir)/man8/
# evz(8) completion
# This completes on a list of all available services for the
# 'evz' command, followed by that script's available commands
#
_evz_list()
{
#COMPREPLY=( $( evz list-all 2>/dev/null ) )
#COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
}
_evz_usage_list()
{
#local USLIST=$(evz ${prev##*/} usage 2>/dev/null | sed -e "y/|/ /" -ne "s/^.*\(u\|U\|msg_u\)sage.*{\(.*\)}.*$/\2/p")
#COMPREPLY=( $( compgen -W '$USLIST' -- "$cur" ) )
# TODO: from evz --help
COMPREPLY=( $( echo "on off stop start destroy" ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
}
_evz()
{
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
# don't complete for things like killall, ssh and mysql if it's
# the standalone command, rather than the init script
[[ ${COMP_WORDS[0]} != "evz" ]] && return 0
# don't complete past 2nd token
[ $COMP_CWORD -gt 2 ] && return 0
if [[ $COMP_CWORD -eq 1 && $prev == "evz" ]]; then
_evz_usage_list
else
_evz_list
fi
return 0
} &&
complete -F _evz evz
#!/bin/sh
#
# Copyright (C) 2017 Etersoft
# Copyright (C) 2017 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
PROGDIR=$(dirname $0)
[ "$PROGDIR" = "." ] && PROGDIR=$(pwd)
fatal()
{
echo "$*" >&2
exit 1
}
info()
{
echo "$*"
}
CMD=$1
shift
case $CMD in
off)
for i in "$@" ; do
info "Stopping $i ..."
vzctl stop $i
# TODO: check if enabled
vzctl set $i --onboot no --save
done
;;
on)
for i in "$@" ; do
info "Starting $i ..."
# TODO: check if enabled
vzctl set $i --onboot yes --save
vzctl start $i
done
;;
stop)
for i in "$@" ; do
info "Stopping $i ..."
vzctl stop $i
done
;;
start)
for i in "$@" ; do
info "Starting $i ..."
vzctl start $i
done
;;
destroy)
echo "You request to destroy follow containers:"
vzlist "$@"
#local response
read -r -p "Are you sure? [Yes/No]" response
[ "$response" = "Yes" ] || fatal "Have no receive your accept."
for i in "$@" ; do
info "Stopping $i ..."
vzctl stop $i
vzctl destroy $i
done
;;
*)
fatal "Unknow command '$CMD'"
;;
esac
#!/bin/sh
checkbashisms -f bin/*
checkbashisms -f Makefile erc.spec
Name: evz
Version: 0.0.1
Release: alt1
Summary: OpenVZ control tool
License: AGPLv3
Group: System/Configuration/Packaging
Url: https://github.com/Etersoft/evz
Packager: Vitaly Lipatov <lav@altlinux.ru>
# Source-git: https://github.com/Etersoft/evz.git
Source: ftp://updates.etersoft.ru/pub/Korinf/sources/tarball/%name-%version.tar
BuildArchitectures: noarch
%description
EVZ is implemented as wrapper around vzctl with accent to group operations on containers.
See detailed description in russian here: http://wiki.etersoft.ru/EVZ
%prep
%setup
%install
# install to datadir and so on
%makeinstall version=%version-%release
mkdir -p %buildroot%_sysconfdir/bash_completion.d/
install -m 0644 bash_completion/evz
# shebang.req.files
#chmod a+x %buildroot%_datadir/%name/{erc-}*
%files
#doc README LICENSE TODO
%_bindir/evz
#_datadir/%name/
%_man8dir/*
%_sysconfdir/bash_completion.d/evz
%changelog
* Sun Oct 22 2017 Vitaly Lipatov <lav@altlinux.ru> 0.9.3-alt1
- add support for pack to zip if one dir arg was received
* Sat Jul 22 2017 Vitaly Lipatov <lav@altlinux.ru> 0.9.2-alt1
- fix get extension: check for tar.* firstly
- allow get type of archive for nonexists files too
* Mon Jul 10 2017 Vitaly Lipatov <lav@altlinux.ru> 0.9.1-alt1
- ercat: add lz4 support
* Fri Apr 22 2016 Vitaly Lipatov <lav@altlinux.ru> 0.9-alt1
- skip repack for the same input and output file
- erc: add add command
- erc: add tgz format recognize
- pack unerc
* Sat Aug 15 2015 Vitaly Lipatov <lav@altlinux.ru> 0.8-alt1
- erc: add -f (--force) for override target, improve test
* Tue Aug 04 2015 Vitaly Lipatov <lav@altlinux.ru> 0.7-alt1
- add zpaq and pax to supported formats
- erc: add options support and implement --quiet
- add unerc command
* Fri Feb 20 2015 Vitaly Lipatov <lav@altlinux.ru> 0.6-alt1
- improve is_target_format to check against supported target formats
* Tue Oct 15 2013 Vitaly Lipatov <lav@altlinux.ru> 0.5-alt1
- erc-archive: fix basename issues
- use bash for all scripts (welcome to debug with dash!)
* Tue Sep 03 2013 Vitaly Lipatov <lav@altlinux.ru> 0.4-alt1
- ercat: add support for plain text files too
- update README, add man pages
* Fri Jul 26 2013 Vitaly Lipatov <lav@altlinux.ru> 0.3-alt1
- small fixes
- erc: enable search and improve help
* Fri Jul 26 2013 Vitaly Lipatov <lav@altlinux.ru> 0.2-alt1
- erc: unpack archive by default
- erc: add support for target arch to create and repack
- introduce ercat: cat any archive to stdout (like bzcat)
* Thu Jul 25 2013 Vitaly Lipatov <lav@altlinux.ru> 0.1-alt1
- initial build for ALT Linux Sisyphus
'\" t
.\"
.\" Author: Vitaly Lipatov
.\"
.\" This file has been put into the public domain.
.\" You can do whatever you want with this file.
.\"
.TH EVZ 8 "November 2017" "Version 0.1"
.SH NAME
evz \- openvz control tool
.SH SYNOPSIS
.B evz
.RI [options]
.RI [command]
.RI VZ(s)
.PP
.br
.SH DESCRIPTION
.BI
EVZ is implemented as wrapper around vzctl with accent to group operations on containers.
.SH OPTIONS
.TP
.I -h
Display help
.TP
.I -V
Show version and exit
.TP
.I -q
Quiet mode
.TP
.SH EXAMPLES
# evz on 25 - enable onboot and start container 25
# evz destroy 5 10 - stop containers 5, 10 and destroy it
# evz restart 10 20 - restart containers 10 20
.SH BUGS
Please report any bugs to lav@etersoft.ru
.SH EXIT STATUS
.B evz
will return zero on success and non zero on operation failure.
.SH SEE ALSO
.BR eepm (1)
.TP
.B http://wiki.etersoft.ru/EVZ
EVZ wiki page
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment