Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ian Eiloart
Sympl
Commits
d7397f32
Commit
d7397f32
authored
Jul 05, 2019
by
Paul Cammish
Browse files
Updated 'sympl' parser
parent
88a6565e
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/bin/sympl
View file @
d7397f32
...
...
@@ -2,7 +2,7 @@
#
# Sympl command line interface.
#
# Copyright 2019, Paul Cammish <sympl@kelduum.net>
# Copyright 2019, Paul Cammish <sympl@kelduum.net>
, part of the Sympl Project.
#
# Licenced under GPL3+
#
...
...
@@ -109,6 +109,45 @@ _is_database() {
# Base #
##############################################################################
_base_none
()
{
echo
"Sympl command-line - a basic parser for common system administraton tasks.
Usage: sympl [function] [action] [target]
Where function is one of:
web, mail, mysql, dns, ftp, cron, backup or blank for the system itself.
And action is one of:
create, enable, disable, audit, update, destroy, set <item|option> <value>
And target is the domain/email address/database/etc.
Useful things:
- Other than using set, the function, action and target can be in any order.
- 'set' requires two arguments immediately after it, the option and value.
- If more permissions are needed, you'll be prompted for your password.
- 'destory' will only destroy something which has already been disabled.
Examples:
sympl web create example.com
sympl mysql disable example_db
sympl enable mail username@example.com
sympl audit backup
sympl destroy cron example.com
sympl example.com set only-ssl on
sympl update
Note: Not all functions are implimented yet.
Please report bugs via http://bugs.sympl.host.
"
}
_base_create
()
{
_noop
}
...
...
@@ -134,13 +173,20 @@ _base_audit() {
}
_base_update
()
{
_noop
_debug
"Updating Apt"
sudo
apt-get
-qq
update
_debug
"Upgrading installed packages"
sudo
apt-get
-q
-y
install
--only-upgrade
'sympl-*'
}
##############################################################################
# Web #
##############################################################################
_web_none
()
{
_noop
}
_web_create
()
{
_is_domain
$1
...
...
@@ -230,15 +276,20 @@ _web_audit() {
}
_web_set
()
{
_noop
}
_web_update
()
{
_noop
}
##############################################################################
# Mysql/MariaDB #
##############################################################################
_mysql_none
()
{
_noop
}
_mysql_create
()
{
...
...
@@ -340,31 +391,43 @@ _mysql_audit() {
mysql
-e
'use mysql; select User from user;'
}
_mysql_update
()
{
_noop
}
##############################################################################
#
FTP
#
#
DNS
#
##############################################################################
_
ftp_creat
e
()
{
_
dns_non
e
()
{
_noop
}
_
ftp_enabl
e
()
{
_
dns_creat
e
()
{
_noop
}
_
ftp_dis
able
()
{
_
dns_en
able
()
{
_noop
}
_
ftp_destroy
()
{
_
dns_disable
()
{
_noop
}
_
ftp_set
()
{
_
dns_destroy
()
{
_noop
}
_ftp_audit
()
{
_dns_set
()
{
_noop
}
_dns_audit
()
{
_noop
}
_dns_update
()
{
_noop
}
...
...
@@ -372,6 +435,10 @@ _ftp_audit() {
# Mail #
##############################################################################
_mail_none
()
{
_noop
}
_mail_create
()
{
_noop
}
...
...
@@ -400,6 +467,10 @@ _mail_audit() {
# FTP #
##############################################################################
_ftp_none
()
{
_noop
}
_ftp_create
()
{
_noop
}
...
...
@@ -424,10 +495,18 @@ _ftp_audit() {
_noop
}
_ftp_update
()
{
_noop
}
##############################################################################
# Backup #
##############################################################################
_backup_none
()
{
_noop
}
_backup_create
()
{
_verbose
"Taking backup..."
sudo
backup2l
-b
...
...
@@ -470,10 +549,18 @@ _backup_audit() {
backup2l
-s
}
_backup_audit
()
{
_noop
}
##############################################################################
# Cron #
##############################################################################
_cron_none
()
{
_noop
}
_cron_create
()
{
_noop
}
...
...
@@ -498,13 +585,17 @@ _cron_audit() {
_noop
}
_cron_update
()
{
_noop
}
##############################################################################
# NoOp Stub #
##############################################################################
_noop
()
{
_warn
"
T
his doesn't do anything yet."
_warn
"
Sorry t
his doesn't do anything yet
, but it may be in a new version.
\n
Run 'sympl update' for an updated version
."
exit
0
}
...
...
@@ -514,8 +605,6 @@ _noop() {
_main
()
{
_debug
"Command line parameters:
$@
"
UNHANDLED
=()
while
[
$#
-gt
0
]
;
do
case
$1
in
...
...
@@ -533,6 +622,7 @@ _main() {
enable
)
_action
'enable'
;
shift
;;
disable
)
_action
'disable'
;
shift
;;
audit|list
)
_action
'audit'
;
shift
;;
update|upgrade
)
_action
'update'
;
shift
;;
set
)
_action
'set'
"
$2
"
"
$3
"
;
shift
;
shift
;
shift
;;
*
)
# unhandled parameter
if
[
$TARGET
=
all
]
;
then
...
...
@@ -545,6 +635,10 @@ _main() {
esac
done
_debug
"Command line parameters:
$@
"
_debug
"Running as '
$I_AM
', EUID '
$EUID
'"
_debug
"Runtime variables:
Unhanded |
$UNHANDLED
FUNCTION |
$FUNCTION
...
...
@@ -554,7 +648,7 @@ _main() {
SETTING |
$SETTING
"
if
[
"x
$UNHANDLED
"
!=
"x"
]
;
then
_help
_
error
"Unexpected input: '
$UNHANDLED
', run 'sympl' for
help
."
fi
_
${
FUNCTION
}
_
${
ACTION
}
$TARGET
$OPTION
$SETTING
...
...
core/debian/changelog
View file @
d7397f32
sympl-core (10.0.190705.0) stable; urgency=medium
* Updated 'sympl' parser, added 'sympl update' function.
-- Paul Cammish <sympl@kelduum.net> Fri, 05 Jul 2019 13:01:00 +0100
sympl-core (10.0.190704.0) stable; urgency=medium
* Workaround for sympl-ssl bug #249 under IPv6 only.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment