first commit
8
.bash_profile
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# "$HOME/.bash_profile"
|
||||
# shellcheck disable=SC1090
|
||||
if [ -f "$HOME/.bashrc" ]
|
||||
then
|
||||
source "$HOME/.bashrc"
|
||||
fi
|
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
### Emacs ###
|
||||
*~
|
||||
\#*\#
|
||||
.\#*
|
77
.gitlab-ci.yml
Normal file
@ -0,0 +1,77 @@
|
||||
image: debian:sid
|
||||
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y locales
|
||||
- sed -i 's/# \(es_ES.UTF-8 UTF-8\)/\1/' /etc/locale.gen
|
||||
- sed -i 's/# \(en_US.UTF-8 UTF-8\)/\1/' /etc/locale.gen
|
||||
- export LANG=es_ES.UTF-8 LANGUAGE=es_ES
|
||||
|
||||
shasums:
|
||||
script:
|
||||
- cp -rv ./hyperterm/ "$HOME/.hyperterm/"
|
||||
- cp -v .bash* "$HOME"
|
||||
- cp -v ./hyperterm/_custom.sh "$HOME"
|
||||
- rm -rfv hyperterm/
|
||||
- (cd "$HOME/.hyperterm/" && sha512sum -c hyperterm.sha512)
|
||||
- (cd "$HOME" && bash -x .bashrc)
|
||||
|
||||
bashrc:
|
||||
script:
|
||||
- apt-get install -y xz-utils shellcheck
|
||||
- shellcheck .bash_profile
|
||||
- shellcheck ./hyperterm/hyperterm.sh
|
||||
- shellcheck ./hyperterm/_custom.sh
|
||||
|
||||
build:
|
||||
script:
|
||||
- apt-get install -y xz-utils shellcheck
|
||||
- shellcheck build.sh
|
||||
- bash -x build.sh
|
||||
|
||||
core:
|
||||
script:
|
||||
- apt-get install -y xz-utils shellcheck
|
||||
- shellcheck hyperterm/core/autocomplete.sh
|
||||
- shellcheck hyperterm/core/colors.sh
|
||||
- shellcheck hyperterm/core/git.sh
|
||||
- shellcheck hyperterm/core/languages.sh
|
||||
- shellcheck hyperterm/core/status.sh
|
||||
- shellcheck hyperterm/core/update.sh
|
||||
|
||||
themes:
|
||||
script:
|
||||
- apt-get install -y xz-utils shellcheck
|
||||
- shellcheck hyperterm/themes/default.sh
|
||||
- shellcheck hyperterm/themes/joy.sh
|
||||
- shellcheck hyperterm/themes/light_theme.sh
|
||||
- shellcheck hyperterm/themes/minterm.sh
|
||||
- shellcheck hyperterm/themes/pure.sh
|
||||
- shellcheck hyperterm/themes/special.sh
|
||||
|
||||
tools:
|
||||
script:
|
||||
- apt-get install -y xz-utils shellcheck
|
||||
- shellcheck hyperterm/tools/aliases.sh
|
||||
- shellcheck hyperterm/tools/compress.sh
|
||||
- shellcheck hyperterm/tools/export.sh
|
||||
- shellcheck hyperterm/tools/listuser.sh
|
||||
- shellcheck hyperterm/tools/network.sh
|
||||
- shellcheck hyperterm/tools/proxy.sh
|
||||
- shellcheck hyperterm/tools/rar2zip.sh
|
||||
- shellcheck hyperterm/tools/ruby.sh
|
||||
- shellcheck hyperterm/tools/ssh-agent.sh
|
||||
- shellcheck hyperterm/tools/sysinfo.sh
|
||||
- shellcheck hyperterm/tools/virtualenv.sh
|
||||
|
||||
install:
|
||||
script:
|
||||
- apt-get install -y xz-utils shellcheck git
|
||||
- shellcheck install.sh
|
||||
- bash -x install.sh -s
|
||||
|
||||
uninstall:
|
||||
script:
|
||||
- apt-get install -y xz-utils shellcheck
|
||||
- shellcheck uninstall.sh
|
||||
- bash -x uninstall.sh -s
|
13
AUTHORS
Normal file
@ -0,0 +1,13 @@
|
||||
=========
|
||||
AUTHORS
|
||||
=========
|
||||
|
||||
This is a list of HyperTerm contributors.
|
||||
They contribute in a variety of different ways
|
||||
and this software would not exist without them.
|
||||
|
||||
Thank you!
|
||||
|
||||
* David P.
|
||||
* Jesús E.
|
||||
* Jorge Maldonado
|
9
HACKING.md
Normal file
@ -0,0 +1,9 @@
|
||||
## Hacking
|
||||
|
||||
1. Generate sha512sum
|
||||
|
||||
- `git clone https://notabug.org/heckyel/hyperterm "$HOME/bash"`
|
||||
|
||||
- `cd "$HOME/bash/"`
|
||||
|
||||
- `bash ./build.sh`
|
674
LICENSE
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 2016 Jesús E. Estupiñan M.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) 2016 Jesús E. Estupiñan M.
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
205
README.md
Normal file
@ -0,0 +1,205 @@
|
||||
# HyperTerm
|
||||
|
||||
Custom Prompt Shell Settings for Bash
|
||||
|
||||
## Requirements
|
||||
|
||||
- wget
|
||||
- curl
|
||||
- git
|
||||
|
||||
## Features
|
||||
- Show Git information (branch, tag, or where you did `git checkout`)
|
||||
- It allows knowing the status (*exit status*) of the Prompt Shell after executing one/some command(s).
|
||||
- Makes source to `/usr/share/doc/pkgfile/command-not-found.bash` automatically (requires `pkgfile`).
|
||||
- Source `/usr/share/bash-completion/bash_completion` automatically (requires `bash-completion`).
|
||||
- Includes a `hyperterm/_custom.sh` for customizations in HyperTerm, separately.
|
||||
|
||||
>Your changes must be in `$HOME/.hyperterm/_custom.sh`, so that are not deleted when it is updated.
|
||||
|
||||
- Special functions like:
|
||||
|
||||
* `activate` to activate virtualenv in python
|
||||
* `cex` compress files and/or directories
|
||||
* `ex` extract files
|
||||
* `ii` general system information
|
||||
* `proxy_on` enables proxy in terminal or tty
|
||||
* `sagent_start` and `sangent_stop` to enable or disable the SSH agent (password is remembered for 432000 seconds)
|
||||
* `rar2zip` convert RAR files to ZIP, use `unar` and `7z`
|
||||
|
||||
- Aliases like:
|
||||
|
||||
* `clean` clears the bash history
|
||||
* `df` shows information about the partitions of the S.O.
|
||||
* `pastebin` allows you to quickly generate a paste for example: `cat/etc/*release | pastebin` or `sensors | pastebin`
|
||||
* `ep` open a PKGBUILD with emacs
|
||||
* `free` shows RAM and SWAP information
|
||||
* `grep` skips its colors by default
|
||||
* `la` short of `ls -la --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F`
|
||||
* `ll` short of `ls -l --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F`
|
||||
* `ls` short of `ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F`
|
||||
* `np` open a PKGBUILD with nano
|
||||
|
||||
- Look at [tools](hyperterm/tools) directory for more functions.
|
||||
- Run `screenfetch` if installed (included in the `hyperterm/_custom.sh` template).
|
||||
|
||||
## Installation
|
||||
|
||||
### Semi-automatic
|
||||
|
||||
1. Download file `install.sh`:
|
||||
|
||||
wget https://git.sr.ht/~heckyel/hyperterm/blob/master/install.sh -O "$HOME/install.sh"
|
||||
|
||||
2. Download file `install.sh`
|
||||
|
||||
bash "$HOME/install.sh"
|
||||
|
||||
or in silent mode:
|
||||
|
||||
bash "$HOME/install.sh" -s
|
||||
|
||||
use -h to show help:
|
||||
|
||||
bash "$HOME/install.sh" -h
|
||||
|
||||
3. Delete file `install.sh`:
|
||||
|
||||
rm -v "$HOME/install.sh"
|
||||
|
||||
### Manual
|
||||
|
||||
1. As a suggestion, make a backup of your Prompt Shell.
|
||||
|
||||
for f in .bashrc .bash_aliases .bash_profile; do cp -v "$HOME/$f" "$HOME/$f.bak"; done
|
||||
|
||||
2. Clone the HyperTerm repository:
|
||||
|
||||
- Mirror 1: `git clone https://git.sr.ht/~heckyel/hyperterm.git "$HOME/bash"`
|
||||
- Mirror 2: `git clone https://notabug.org/heckyel/hyperterm.git "$HOME/bash"`
|
||||
|
||||
3. Copy the HyperTerm files to your Local Directory
|
||||
|
||||
install -d -m755 "$HOME/.hyperterm"
|
||||
|
||||
cp -rv $HOME/bash/hyperterm/* "$HOME/.hyperterm"
|
||||
|
||||
cp -v $HOME/bash/.bash* "$HOME"
|
||||
|
||||
cp -v $HOME/bash/hyperterm/_custom.sh "$HOME/.hyperterm"
|
||||
|
||||
install -m644 $HOME/bash/template/bash_profile.template.bash "$HOME/.bashrc"
|
||||
|
||||
4. Open your terminal again or execute the next instruction
|
||||
|
||||
. $HOME/.bashrc*
|
||||
|
||||
5. Delete the repository if you are not interested in having it stored
|
||||
|
||||
rm -rfv bash
|
||||
|
||||
6. Done!
|
||||
|
||||
## Post-installation
|
||||
|
||||
* Optionally you can install trash-cli, pkgfile, bind-tools, bash-completion
|
||||
|
||||
pacman -S trash-cli
|
||||
|
||||
pacman -S pkgfile
|
||||
|
||||
pacman -S bind-tools
|
||||
|
||||
pacman -S bash-completion
|
||||
|
||||
> [trash-cli](https://github.com/andreafrancia/trash-cli): is a utility to prevent accidental deletion when using the rm -rf command
|
||||
|
||||
> [pkgfile](https://github.com/falconindy/pkgfile): allows you to search for the command executed in the repository database
|
||||
|
||||
> [bind-tools](https://www.isc.org/downloads/bind/): allows to get ISP, running 'ii' in terminal
|
||||
|
||||
> [bash-completion](https://github.com/scop/bash-completion): allows bash autocomplete
|
||||
|
||||
## Upgrade
|
||||
|
||||
- To update just open the terminal and run:
|
||||
|
||||
`updbashrc` to update HyperTerm
|
||||
|
||||
`updbashrc_custom` just to update file `hyperterm/_custom.sh`
|
||||
|
||||
## Screenshots
|
||||
|
||||
### Git
|
||||
|
||||

|
||||
|
||||
### Themes
|
||||
|
||||
#### default
|
||||
|
||||

|
||||
|
||||
#### joy
|
||||
|
||||

|
||||
|
||||
#### light_theme
|
||||
|
||||

|
||||
|
||||
#### minterm
|
||||
|
||||

|
||||
|
||||
#### pure
|
||||
|
||||

|
||||
|
||||
#### special
|
||||
|
||||

|
||||
|
||||
> The theme is configurable from file `$HOME/.hyperterm/_custom.sh`
|
||||
|
||||
## Uninstall
|
||||
|
||||
### Semi-automatic
|
||||
|
||||
1. Download file `uninstall.sh`:
|
||||
|
||||
wget https://git.sr.ht/~heckyel/hyperterm/blob/master/uninstall.sh -O "$HOME/uninstall.sh"
|
||||
|
||||
o
|
||||
|
||||
wget https://notabug.org/heckyel/hyperterm/raw/master/uninstall.sh -O "$HOME/uninstall.sh"
|
||||
|
||||
2. Download file `uninstall.sh`:
|
||||
|
||||
bash "$HOME/uninstall.sh"
|
||||
|
||||
3. Delete file `uninstall.sh`:
|
||||
|
||||
rm -v "$HOME/uninstall.sh"
|
||||
|
||||
### Manual
|
||||
|
||||
If you want to leave your computer as it was, delete the files copied from step 3 with:
|
||||
|
||||
rm -vrf "$HOME/{.hyperterm/,.bashrc}"
|
||||
|
||||
and restore the ***.bak** files from step 1 by running:
|
||||
|
||||
for f in .bashrc .bash_aliases .bash_profile; do cp -v "$HOME/$f.bak" "$HOME/$f"; done
|
||||
|
||||
## Hacking
|
||||
|
||||
See [HACKING.md](HACKING.md)
|
||||
|
||||
## Contributors
|
||||
|
||||
**HyperTerm** contributors can be found in the [AUTHORS](AUTHORS) file
|
||||
|
||||
## License
|
||||
|
||||
This work is licensed under the [GNU GPLv3+](LICENSE)
|
205
README_es.md
Normal file
@ -0,0 +1,205 @@
|
||||
# HyperTerm
|
||||
|
||||
Configuración personalizada del Prompt Shell para Bash
|
||||
|
||||
## Dependencias
|
||||
|
||||
- wget
|
||||
- curl
|
||||
- git
|
||||
|
||||
## Características
|
||||
- Muestra información de Git (rama, tag, o donde hiciste `git checkout`)
|
||||
- Permite saber el estado (*exit status*) del Prompt Shell después de ejecutar un/unos comando(s).
|
||||
- Hace source a `/usr/share/doc/pkgfile/command-not-found.bash` automaticamente (requiere de `pkgfile`).
|
||||
- Hace source a `/usr/share/bash-completion/bash_completion` automaticamente (requiere de `bash-completion`).
|
||||
- Incluye un `hyperterm/_custom.sh` para personalizaciones en el HyperTerm, de forma separada.
|
||||
|
||||
>Tus cambios deben estar en `$HOME/.hyperterm/_custom.sh`, para que no se eliminen al momento de actualizarlo.
|
||||
|
||||
- Funciones especiales como:
|
||||
|
||||
* `activate` para activar virtualenv en python
|
||||
* `cex` comprimir archivos y/o directorios
|
||||
* `ex` extraer archivos
|
||||
* `ii` información general del sistema
|
||||
* `proxy_on` activa proxy en el terminal o tty
|
||||
* `sagent_start` y `sangent_stop` para activar o desactivar el agente SSH (la contraseña es recordada por 432000 segundos)
|
||||
* `rar2zip` convierte archivos RAR a ZIP, utiliza `unar` y `7z`
|
||||
|
||||
- Aliases como:
|
||||
|
||||
* `clean` limpia el historial de bash
|
||||
* `df` muestra información de las particiones del S.O.
|
||||
* `pastebin` permite generar rápidamente un paste por ejemplo: `cat /etc/*release | pastebin` o `sensors | pastebin`
|
||||
* `ep` abre un PKGBUILD con emacs
|
||||
* `free` muestra información de la RAM y SWAP
|
||||
* `grep` salta los colores del mismo por defecto
|
||||
* `la` abreviación de `ls -la --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F`
|
||||
* `ll` abreviación de `ls -l --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F`
|
||||
* `ls` abreviación de `ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F`
|
||||
* `np` abre un PKGBUILD con nano
|
||||
|
||||
- Mirar el directorio [tools](hyperterm/tools) para conocer más funciones.
|
||||
- Ejecuta `screenfetch` si está instalado (incluido en la plantilla `hyperterm/_custom.sh`).
|
||||
|
||||
## Instalación
|
||||
|
||||
### Instalación semi-automática
|
||||
|
||||
1. Descargar el archivo `install.sh`:
|
||||
|
||||
wget https://git.sr.ht/~heckyel/hyperterm/blob/master/install.sh -O "$HOME/install.sh"
|
||||
|
||||
2. Ejecutar el archivo `install.sh`
|
||||
|
||||
bash "$HOME/install.sh"
|
||||
|
||||
o en modo silencioso:
|
||||
|
||||
bash "$HOME/install.sh" -s
|
||||
|
||||
utilice -h para mostrar ayuda:
|
||||
|
||||
bash "$HOME/install.sh" -h
|
||||
|
||||
3. Eliminar el archivo `install.sh`:
|
||||
|
||||
rm -v "$HOME/install.sh"
|
||||
|
||||
### Instalación Manual
|
||||
|
||||
1. Como sugerencia haz un respaldo de tu Prompt Shell.
|
||||
|
||||
for f in .bashrc .bash_aliases .bash_profile; do cp -v "$HOME/$f" "$HOME/$f.bak"; done
|
||||
|
||||
2. Clona el repositorio HyperTerm:
|
||||
|
||||
- Mirror 1: `git clone https://git.sr.ht/~heckyel/hyperterm.git "$HOME/bash"`
|
||||
- Mirror 2: `git clone https://notabug.org/heckyel/hyperterm.git "$HOME/bash"`
|
||||
|
||||
3. Copia los archivos de HyperTerm en tu Directorio Local
|
||||
|
||||
install -d -m755 "$HOME/.hyperterm"
|
||||
|
||||
cp -rv $HOME/bash/hyperterm/* "$HOME/.hyperterm"
|
||||
|
||||
cp -v $HOME/bash/.bash* "$HOME"
|
||||
|
||||
cp -v $HOME/bash/hyperterm/_custom.sh "$HOME/.hyperterm"
|
||||
|
||||
install -m644 $HOME/bash/template/bash_profile.template.bash "$HOME/.bashrc"
|
||||
|
||||
4. Vuelve abrir tu terminal ó ejecuta la siguiente instrucción
|
||||
|
||||
. $HOME/.bashrc*
|
||||
|
||||
5. Borra el repositorio si no te interesa tenerlo almacenado
|
||||
|
||||
rm -rfv bash
|
||||
|
||||
6. Listo!
|
||||
|
||||
## Post-instalación
|
||||
|
||||
* Opcionalmente puede instalar trash-cli, pkgfile, bind-tools, bash-completion
|
||||
|
||||
pacman -S trash-cli
|
||||
|
||||
pacman -S pkgfile
|
||||
|
||||
pacman -S bind-tools
|
||||
|
||||
pacman -S bash-completion
|
||||
|
||||
> [trash-cli](https://github.com/andreafrancia/trash-cli): es una utilidad para prevenir el borrado accidental al usar el comando rm -rf
|
||||
|
||||
> [pkgfile](https://github.com/falconindy/pkgfile): permite buscar el comando ejecutado en la base de datos del repositorio.
|
||||
|
||||
> [bind-tools](https://www.isc.org/downloads/bind/): permite obtener la ISP al ejecutar 'ii' en la terminal.
|
||||
|
||||
> [bash-completion](https://github.com/scop/bash-completion): permite el autocompletado de bash
|
||||
|
||||
## Actualización
|
||||
|
||||
- Para actualizar solo abre la terminal y ejecuta:
|
||||
|
||||
`updbashrc` para actualizar HyperTerm
|
||||
|
||||
`updbashrc_custom` solo para actualizar el archivo `hyperterm/_custom.sh`
|
||||
|
||||
## Capturas de pantalla
|
||||
|
||||
### Git
|
||||
|
||||

|
||||
|
||||
### Temas
|
||||
|
||||
#### default
|
||||
|
||||

|
||||
|
||||
#### joy
|
||||
|
||||

|
||||
|
||||
#### light_theme
|
||||
|
||||

|
||||
|
||||
#### minterm
|
||||
|
||||

|
||||
|
||||
#### pure
|
||||
|
||||

|
||||
|
||||
#### special
|
||||
|
||||

|
||||
|
||||
> El tema es configurable desde el archivo `$HOME/.hyperterm/_custom.sh`
|
||||
|
||||
## Restaurar
|
||||
|
||||
### Semi-Automático
|
||||
|
||||
1. Descargar el archivo `uninstall.sh`:
|
||||
|
||||
wget https://git.sr.ht/~heckyel/hyperterm/tree/master/item/uninstall.sh -O "$HOME/uninstall.sh"
|
||||
|
||||
o
|
||||
|
||||
wget https://notabug.org/heckyel/hyperterm/raw/master/uninstall.sh -O "$HOME/uninstall.sh"
|
||||
|
||||
2. Ejecutar el archivo `uninstall.sh`:
|
||||
|
||||
bash "$HOME/uninstall.sh"
|
||||
|
||||
3. Eliminar el archivo `uninstall.sh`:
|
||||
|
||||
rm -v "$HOME/uninstall.sh"
|
||||
|
||||
### Manualmente
|
||||
|
||||
Si quieres dejar tu ordenador como estaba, borra los archivos copiados del paso 3 con:
|
||||
|
||||
rm -vrf "$HOME/{.hyperterm/,.bashrc}"
|
||||
|
||||
y restaura los archivos ***.bak** del paso 1 ejecutando:
|
||||
|
||||
for f in .bashrc .bash_aliases .bash_profile; do cp -v "$HOME/$f.bak" "$HOME/$f"; done
|
||||
|
||||
## Hacking
|
||||
|
||||
Ver [HACKING.md](HACKING.md)
|
||||
|
||||
## Contribuidores
|
||||
|
||||
Los colaboradores de **HyperTerm** se encuentran en el archivo [AUTHORS](AUTHORS)
|
||||
|
||||
## Licencia
|
||||
|
||||
Esta obra esta bajo la Licencia [GNU GPLv3+](LICENSE)
|
24
build.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -n "$(ls -a ./hyperterm/)" && -f ./.bash_profile ]];
|
||||
then
|
||||
cd ./hyperterm/ || exit
|
||||
|
||||
var1=$(find ../ -name ".bash*" -type f -exec sha512sum {} \;)
|
||||
var2=$(find . -type f -name "*.sh" ! -iname "_custom.sh" -exec sha512sum {} \;)
|
||||
|
||||
alist="echo $var1 $var2"
|
||||
$alist > tmp.txt
|
||||
|
||||
output="fmt -w 160 tmp.txt"
|
||||
|
||||
$output > hyperterm.sha512
|
||||
|
||||
rm -rf tmp.txt
|
||||
|
||||
sha512sum -c hyperterm.sha512
|
||||
|
||||
printf '\e[1;36m%s\e[m\n' "success hyperterm.sha512"
|
||||
else
|
||||
printf '\e[1;31m%s\e[m\n' "Error! files not found for verification"
|
||||
fi
|
60
hyperterm/_custom.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
## [Alias]
|
||||
# shellcheck disable=SC1090,SC1091,SC2034,SC2154
|
||||
|
||||
#---------------
|
||||
# Fullyclean
|
||||
#---------------
|
||||
alias ac='clean && clear'
|
||||
|
||||
#---------------
|
||||
# Theme's prompt
|
||||
#---------------
|
||||
if [[ -f $HOME/.hyperterm/themes/joy.sh ]]; then source "$HOME/.hyperterm/themes/joy.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/themes/light_theme.sh ]]; then source "$HOME/.hyperterm/themes/light_theme.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/themes/minterm.sh ]]; then source "$HOME/.hyperterm/themes/minterm.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/themes/pure.sh ]]; then source "$HOME/.hyperterm/themes/pure.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/themes/special.sh ]]; then source "$HOME/.hyperterm/themes/special.sh"; else true; fi
|
||||
|
||||
#---------------
|
||||
# Set Theme
|
||||
#---------------
|
||||
unset prompt
|
||||
prompt="${default}"
|
||||
#prompt="${joy}"
|
||||
#prompt="${light_theme}"
|
||||
#prompt="${minterm}"
|
||||
#prompt="${pure}"
|
||||
#prompt="${special}"
|
||||
|
||||
#---------------
|
||||
# Tools
|
||||
#---------------
|
||||
if [[ -f $HOME/.hyperterm/tools/compress.sh ]]; then source "$HOME/.hyperterm/tools/compress.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/export.sh ]]; then source "$HOME/.hyperterm/tools/export.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/listuser.sh ]]; then source "$HOME/.hyperterm/tools/listuser.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/network.sh ]]; then source "$HOME/.hyperterm/tools/network.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/proxy.sh ]]; then source "$HOME/.hyperterm/tools/proxy.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/rar2zip.sh ]]; then source "$HOME/.hyperterm/tools/rar2zip.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/ruby.sh ]]; then source "$HOME/.hyperterm/tools/ruby.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/ssh-agent.sh ]]; then source "$HOME/.hyperterm/tools/ssh-agent.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/sysinfo.sh ]]; then source "$HOME/.hyperterm/tools/sysinfo.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/tools/virtualenv.sh ]]; then source "$HOME/.hyperterm/tools/virtualenv.sh"; else true; fi
|
||||
# if [[ -f $HOME/.hyperterm/tools/vconverter.sh ]]; then source "$HOME/.hyperterm/tools/vconverter.sh"; else true; fi
|
||||
|
||||
#---------------
|
||||
# Screenfetch
|
||||
#---------------
|
||||
if command -v screenfetch &> /dev/null; then screenfetch; else true; fi
|
||||
|
||||
#---------------
|
||||
# PKGFILE
|
||||
#---------------
|
||||
if [[ -f /usr/share/doc/pkgfile/command-not-found.bash ]]; then source /usr/share/doc/pkgfile/command-not-found.bash; else true; fi
|
||||
|
||||
#---------------
|
||||
# Trash-cli
|
||||
#---------------
|
||||
if command -v trash &> /dev/null; then alias rm='echo "This is not the command you are looking for."; false'; else true; fi
|
||||
# Then, if you really want to use rm, simply prepend a slash to bypass the alias:
|
||||
# \rm file-without-hope
|
22
hyperterm/core/autocomplete.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1091
|
||||
# bash completion on Hyperbola: pacman -S bash-completion
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
# Autocompletado
|
||||
complete -cf sudo
|
||||
|
||||
shopt -s cdspell
|
||||
shopt -s checkwinsize
|
||||
shopt -s cmdhist
|
||||
shopt -s dotglob
|
||||
shopt -s expand_aliases
|
||||
shopt -s extglob
|
||||
shopt -s histappend
|
||||
shopt -s hostcomplete
|
96
hyperterm/core/colors.sh
Normal file
@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
function _colors_bash () {
|
||||
if tput setaf 1 &> /dev/null; then
|
||||
# If you would like to customize your colors, use
|
||||
# # example 1
|
||||
# for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; printf '%s\n' "=$c"; done
|
||||
# # example 2
|
||||
# for i in $(seq 0 $(tput colors)); do
|
||||
# printf '%s\n' " $(tput setaf $i)Text$(tput sgr0) $(tput bold)$(tput setaf $i)Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf $i)Text$(tput sgr0) \$(tput setaf $i)"
|
||||
# done
|
||||
|
||||
# Reset the shell from our `if` check
|
||||
tput sgr0 &> /dev/null
|
||||
# If the terminal supports at least 256 colors, write out our 256 color based set
|
||||
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
|
||||
BLUE=$(tput setaf 27)
|
||||
CYAN=$(tput setaf 39)
|
||||
GREEN=$(tput setaf 76)
|
||||
GREY=$(tput setaf 250)
|
||||
LEMON=$(tput setaf 154)
|
||||
ORANGE=$(tput setaf 172)
|
||||
PURPLE=$(tput setaf 200)
|
||||
RED=$(tput setaf 9)
|
||||
YELLOW=$(tput setaf 226)
|
||||
else
|
||||
# Otherwise, use colors from our set of 8
|
||||
BLUE=$(tput setaf 4)
|
||||
CYAN=$(tput setaf 6)
|
||||
GREEN=$(tput setaf 2)
|
||||
GREY=$(tput setaf 7)
|
||||
LEMON=$(tput setaf 3)
|
||||
ORANGE=$(tput setaf 4)
|
||||
PURPLE=$(tput setaf 5)
|
||||
RED=$(tput setaf 1)
|
||||
YELLOW=$(tput setaf 3)
|
||||
fi
|
||||
BOLD=$(tput bold)
|
||||
RESET=$(tput sgr0)
|
||||
else
|
||||
# Otherwise, use ANSI escape sequences for coloring
|
||||
# If you would like to customize your colors, use
|
||||
# DEV: 30-39 lines up 0-9 from `tput`
|
||||
# for i in $(seq 0 109); do
|
||||
# echo -n -e "\033[1;${i}mText$(tput sgr0) "
|
||||
# echo "\033[1;${i}m"
|
||||
# done
|
||||
BLUE='\033[1;34m'
|
||||
CYAN='\033[1;36m'
|
||||
GREEN='\033[1;32m'
|
||||
GREY='\033[0;37m'
|
||||
LEMON='\033[1;33m'
|
||||
ORANGE='\033[1;33m'
|
||||
PURPLE='\033[1;35m'
|
||||
RED='\033[1;31m'
|
||||
WHITE='\033[1m'
|
||||
YELLOW='\033[1;33m'
|
||||
|
||||
BOLD=''
|
||||
RESET='\033[m'
|
||||
fi
|
||||
|
||||
# Define the default prompt terminator character '$'
|
||||
if [[ "$UID" == 0 ]]; then
|
||||
SYMBOL="#"
|
||||
else
|
||||
SYMBOL="\$"
|
||||
fi
|
||||
|
||||
# export
|
||||
export BLUE
|
||||
export CYAN
|
||||
export GREEN
|
||||
export GREY
|
||||
export LEMON
|
||||
export ORANGE
|
||||
export PURPLE
|
||||
export RED
|
||||
export WHITE
|
||||
export YELLOW
|
||||
|
||||
export BOLD
|
||||
export RESET
|
||||
export SYMBOL
|
||||
}
|
||||
|
||||
# Xterm-colors
|
||||
_xterm_fackground="xterm*background: black"
|
||||
_xterm_foreground="xterm*foreground: lightgray"
|
||||
|
||||
if [[ ! -e "$HOME/.Xresources" && $EUID -ne 0 ]]; then
|
||||
printf '%s\n%s' "$_xterm_fackground" "$_xterm_foreground" | tee -a "$HOME/.Xresources" &> /dev/null
|
||||
xrdb "$HOME/.Xresources" &> /dev/null
|
||||
else
|
||||
xrdb "$HOME/.Xresources" &> /dev/null
|
||||
fi
|
332
hyperterm/core/git.sh
Normal file
@ -0,0 +1,332 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set up symbols
|
||||
function _symbols() {
|
||||
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
_synced_symbol="$(printf '%b\u2714' "${BOLD}${CYAN}")" # ✔
|
||||
_dirty_synced_symbol="$(printf '%b\u002A' "${BOLD}${RED}")" # ∗
|
||||
_unpushed_symbol="$(printf '%b\u2191' "${BOLD}${CYAN}")" # ↑
|
||||
_dirty_unpushed_symbol="$(printf '%b\u25B2' "${BOLD}${YELLOW}")" # ▲
|
||||
_unpulled_symbol="$(printf '%b\u25BD' "${BOLD}${GREEN}")" # ▽
|
||||
_dirty_unpulled_symbol="$(printf '%b\u25BC' "${BOLD}${RED}")" # ▼
|
||||
_stage_symbol="$(printf '%b\u2192\u004D' "${BOLD}${CYAN}")" # →M
|
||||
_unstage_symbol="$(printf '%b\u2190\u004D' "${BOLD}${RED}")" # ←M
|
||||
_untracked_symbol="$(printf '%b\u003F' "${BOLD}${RED}")" # ?
|
||||
_newfile_symbol="$(printf '%b\u002B' "${BOLD}${CYAN}")" # +
|
||||
_deleted_file_symbol="$(printf '%b\u2013' "${BOLD}${RED}")" # –
|
||||
_renamed_symbol="$(printf '%b\u2387 ' "${BOLD}${RED}")" # ⎇
|
||||
_unpushed_unpulled_symbol="$(printf '%b\u2B21' "${BOLD}${RED}")" # ⬡
|
||||
_dirty_unpushed_unpulled_symbol="$(printf '%b\u2B22' "${BOLD}${RED}")" # ⬢
|
||||
}
|
||||
|
||||
function _get_git_branch() {
|
||||
# On branches, this will return the branch name
|
||||
# On non-branches, (no branch)
|
||||
ref="$(git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///')"
|
||||
if [[ -n $ref ]]; then
|
||||
printf '%s' "$ref"
|
||||
else
|
||||
printf "(no branch)"
|
||||
fi
|
||||
}
|
||||
|
||||
function _get_git_progress() {
|
||||
# Detect in-progress actions (e.g. merge, rebase)
|
||||
# https://github.com/git/git/blob/v1.9-rc2/wt-status.c#L1199-L1241
|
||||
git_dir="$(git rev-parse --git-dir)"
|
||||
|
||||
# git merge
|
||||
if [[ -f "$git_dir/MERGE_HEAD" ]]; then
|
||||
printf " [merge]"
|
||||
elif [[ -d "$git_dir/rebase-apply" ]]; then
|
||||
# git am
|
||||
if [[ -f "$git_dir/rebase-apply/applying" ]]; then
|
||||
printf " [am]"
|
||||
# git rebase
|
||||
else
|
||||
printf " [rebase]"
|
||||
fi
|
||||
elif [[ -d "$git_dir/rebase-merge" ]]; then
|
||||
# git rebase --interactive/--merge
|
||||
printf " [rebase]"
|
||||
elif [[ -f "$git_dir/CHERRY_PICK_HEAD" ]]; then
|
||||
# git cherry-pick
|
||||
printf " [cherry-pick]"
|
||||
fi
|
||||
if [[ -f "$git_dir/BISECT_LOG" ]]; then
|
||||
# git bisect
|
||||
printf " [bisect]"
|
||||
fi
|
||||
if [[ -f "$git_dir/REVERT_HEAD" ]]; then
|
||||
# git revert --no-commit
|
||||
printf " [revert]"
|
||||
fi
|
||||
}
|
||||
|
||||
_prompt_is_branch1_behind_branch2 () {
|
||||
# $ git log origin/master..master -1
|
||||
# commit 4a633f715caf26f6e9495198f89bba20f3402a32
|
||||
# Author: Todd Wolfson <todd@twolfson.com>
|
||||
# Date: Sun Jul 7 22:12:17 2013 -0700
|
||||
#
|
||||
# Unsynced commit
|
||||
|
||||
# Find the first log (if any) that is in branch1 but not branch2
|
||||
first_log="$(git log "$1..$2" -1 2> /dev/null)"
|
||||
|
||||
# Exit with 0 if there is a first log, 1 if there is not
|
||||
[[ -n "$first_log" ]]
|
||||
}
|
||||
|
||||
_prompt_branch_exists () {
|
||||
# List remote branches | # Find our branch and exit with 0 or 1 if found/not found
|
||||
git branch --remote 2> /dev/null | grep --quiet "$1"
|
||||
}
|
||||
|
||||
_prompt_parse_git_ahead () {
|
||||
# Grab the local and remote branch
|
||||
branch="$(_get_git_branch)"
|
||||
remote="$(git config --get "branch.${branch}.remote" || echo -n "origin")"
|
||||
remote_branch="$remote/$branch"
|
||||
|
||||
# $ git log origin/master..master
|
||||
# commit 4a633f715caf26f6e9495198f89bba20f3402a32
|
||||
# Author: Todd Wolfson <todd@twolfson.com>
|
||||
# Date: Sun Jul 7 22:12:17 2013 -0700
|
||||
#
|
||||
# Unsynced commit
|
||||
|
||||
# If the remote branch is behind the local branch
|
||||
# or it has not been merged into origin (remote branch doesn't exist)
|
||||
if (_prompt_is_branch1_behind_branch2 "$remote_branch" "$branch" ||
|
||||
! _prompt_branch_exists "$remote_branch"); then
|
||||
# printf our character
|
||||
printf '%s' '0'
|
||||
fi
|
||||
}
|
||||
|
||||
_prompt_parse_git_behind() {
|
||||
# Grab the branch
|
||||
branch="$(_get_git_branch)"
|
||||
remote="$(git config --get "branch.${branch}.remote" || echo -n "origin")"
|
||||
remote_branch="$remote/$branch"
|
||||
|
||||
# $ git log master..origin/master
|
||||
# commit 4a633f715caf26f6e9495198f89bba20f3402a32
|
||||
# Author: Todd Wolfson <todd@twolfson.com>
|
||||
# Date: Sun Jul 7 22:12:17 2013 -0700
|
||||
#
|
||||
# Unsynced commit
|
||||
|
||||
# If the local branch is behind the remote branch
|
||||
if _prompt_is_branch1_behind_branch2 "$branch" "$remote_branch"; then
|
||||
# printf our character
|
||||
printf '%s' '0'
|
||||
fi
|
||||
}
|
||||
|
||||
function _prompt_parse_git_dirty() {
|
||||
# If the git status has *any* changes (e.g. dirty), printf our character
|
||||
if [[ -n "$(git status --porcelain 2> /dev/null)" ]]; then
|
||||
printf '%s' '0'
|
||||
fi
|
||||
}
|
||||
|
||||
# start counter on git
|
||||
function _git_dirty_count() {
|
||||
local _dirty_status
|
||||
local _git_status
|
||||
_dirty_status="$(_prompt_parse_git_dirty)"
|
||||
_git_status="$(git status --porcelain 2> /dev/null)"
|
||||
if [[ "$_dirty_status" == 0 ]]; then
|
||||
local change_count
|
||||
change_count="$(echo "$_git_status" | wc -l | tr -d '[:space:]')"
|
||||
if [[ "$change_count" == 1 ]]; then
|
||||
printf '%b\u2022%s' "${BOLD}${GREY}" "$change_count"
|
||||
elif [[ "$change_count" == 2 ]]; then
|
||||
printf '%b\u2236%s' "${BOLD}${GREY}" "$change_count"
|
||||
elif [[ "$change_count" == 3 ]]; then
|
||||
printf '%b\u2026%s' "${BOLD}${GREY}" "$change_count"
|
||||
else
|
||||
printf '%b\u00BB%s' "${BOLD}${GREY}" "$change_count"
|
||||
fi
|
||||
else
|
||||
printf ''
|
||||
fi
|
||||
}
|
||||
# ends counter on git
|
||||
|
||||
function _prompt_parse_git_untracked() {
|
||||
local untracked
|
||||
local evaltask
|
||||
untracked="$(git status 2>&1 | tee)"
|
||||
grep -E 'Untracked files:' <<<"$untracked" &> /dev/null
|
||||
evaltask=$?
|
||||
if [ "$evaltask" -eq 0 ]; then
|
||||
printf '%s' '0'
|
||||
else
|
||||
printf '%s' '1'
|
||||
fi
|
||||
}
|
||||
|
||||
function _prompt_parse_git_newfile() {
|
||||
local newfile
|
||||
local evaltask
|
||||
newfile="$(git status 2>&1 | tee)"
|
||||
grep -E 'new file:' <<<"$newfile" &> /dev/null
|
||||
evaltask=$?
|
||||
if [ "$evaltask" -eq 0 ]; then
|
||||
printf '%s' '0'
|
||||
else
|
||||
printf '%s' '1'
|
||||
fi
|
||||
}
|
||||
|
||||
function _prompt_parse_git_deleted_file() {
|
||||
local deleted_file
|
||||
local evaltask
|
||||
deleted_file="$(git status 2>&1 | tee)"
|
||||
grep -E 'deleted:' <<<"$deleted_file" &> /dev/null
|
||||
evaltask=$?
|
||||
if [ "$evaltask" -eq 0 ]; then
|
||||
printf '%s' '0'
|
||||
else
|
||||
printf '%s' '1'
|
||||
fi
|
||||
}
|
||||
|
||||
function _prompt_parse_git_renamed() {
|
||||
local renamed
|
||||
local evaltask
|
||||
renamed="$(git status 2>&1 | tee)"
|
||||
grep -E 'renamed:' <<<"$renamed" &> /dev/null
|
||||
evaltask=$?
|
||||
if [ "$evaltask" -eq 0 ]; then
|
||||
printf '%s' '0'
|
||||
else
|
||||
printf '%s' '1'
|
||||
fi
|
||||
}
|
||||
|
||||
function _prompt_parse_git_unstage() {
|
||||
local unstage
|
||||
local evaltask
|
||||
unstage="$(git status 2>&1 | tee)"
|
||||
grep -E 'not staged' <<<"$unstage" &> /dev/null
|
||||
evaltask=$?
|
||||
if [ "$evaltask" -eq 0 ]; then
|
||||
printf '%s' '0'
|
||||
else
|
||||
printf '%s' '1'
|
||||
fi
|
||||
}
|
||||
|
||||
function _prompt_parse_git_stage() {
|
||||
local stage
|
||||
local evaltask
|
||||
stage="$(git status -s 2>&1 | tee)"
|
||||
grep -E 'M' <<<"$stage" &> /dev/null
|
||||
evaltask=$?
|
||||
if [ "$evaltask" -eq 0 ]; then
|
||||
printf '%s' '0'
|
||||
else
|
||||
printf '%s' '1'
|
||||
fi
|
||||
}
|
||||
|
||||
function _prompt_is_on_git() {
|
||||
git rev-parse 2> /dev/null
|
||||
}
|
||||
|
||||
function _prompt_get_git_status() {
|
||||
|
||||
_symbols "$@"
|
||||
|
||||
# Grab the git dirty and git behind
|
||||
git_count="$(_git_dirty_count)"
|
||||
dirty_branch="$(_prompt_parse_git_dirty)"
|
||||
branch_ahead="$(_prompt_parse_git_ahead)"
|
||||
branch_behind="$(_prompt_parse_git_behind)"
|
||||
branch_stage="$(_prompt_parse_git_stage)"
|
||||
branch_unstage="$(_prompt_parse_git_unstage)"
|
||||
branch_untracked="$(_prompt_parse_git_untracked)"
|
||||
branch_newfile="$(_prompt_parse_git_newfile)"
|
||||
branch_deleted_file="$(_prompt_parse_git_deleted_file)"
|
||||
branch_renamed="$(_prompt_parse_git_renamed)"
|
||||
|
||||
# Iterate through all the cases and if it matches, then printf
|
||||
if [[ "$dirty_branch" == 0 && "$branch_ahead" == 0 && "$branch_behind" == 0 ]]; then
|
||||
printf '%s%s' "$_dirty_unpushed_unpulled_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_ahead" == 0 && "$branch_behind" == 0 ]]; then
|
||||
printf '%s%s' "$_unpushed_unpulled_symbol" "$git_count"
|
||||
|
||||
elif [[ "$dirty_branch" == 0 && "$branch_ahead" == 0 ]]; then
|
||||
printf '%s%s' "$_dirty_unpushed_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_ahead" == 0 ]]; then
|
||||
printf '%s%s' "$_unpushed_symbol" "$git_count"
|
||||
|
||||
elif [[ "$dirty_branch" == 0 && "$branch_behind" == 0 ]]; then
|
||||
printf '%s%s' "$_dirty_unpulled_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_behind" == 0 ]]; then
|
||||
printf '%s%s' "$_unpulled_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_unstage" == 0 && "$branch_untracked" == 0 ]]; then
|
||||
printf '%s%s' "${_unstage_symbol}${_untracked_symbol}" "$git_count"
|
||||
|
||||
elif [[ "$branch_stage" == 0 && "$branch_untracked" == 0 ]]; then
|
||||
printf '%s%s' "${_stage_symbol}${_untracked_symbol}" "$git_count"
|
||||
|
||||
elif [[ "$branch_stage" == 0 && "$branch_unstage" == 0 ]]; then
|
||||
printf '%s%s' "$_unstage_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_newfile" == 0 && "$branch_untracked" == 0 ]]; then
|
||||
printf '%s%s' "${_newfile_symbol}${_untracked_symbol}" "$git_count"
|
||||
|
||||
elif [[ "$branch_untracked" == 0 ]]; then
|
||||
printf '%s%s' "$_untracked_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_stage" == 0 ]]; then
|
||||
printf '%s%s' "$_stage_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_newfile" == 0 ]]; then
|
||||
printf '%s%s' "$_newfile_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_deleted_file" == 0 ]]; then
|
||||
printf '%s%s' "$_deleted_file_symbol" "$git_count"
|
||||
|
||||
elif [[ "$branch_renamed" == 0 ]]; then
|
||||
printf '%s%s' "$_renamed_symbol" "$git_count"
|
||||
|
||||
elif [[ "$dirty_branch" == 0 ]]; then
|
||||
printf '%s%s' "$_dirty_synced_symbol" "$git_count"
|
||||
|
||||
else # clean
|
||||
printf '%s' "$_synced_symbol"
|
||||
fi
|
||||
}
|
||||
|
||||
_prompt_get_git_info() {
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
# Grab the branch
|
||||
branch="$(_get_git_branch)"
|
||||
|
||||
# If there are any branches
|
||||
if [[ -n $branch ]]; then
|
||||
# Printf the branch
|
||||
output="$branch"
|
||||
|
||||
# Add on the git status
|
||||
output="$output$(_prompt_get_git_status "$@")"
|
||||
|
||||
# Printf our output
|
||||
printf '%b%s%b' "${BOLD}${LEMON}" "git:($output" "${BOLD}${LEMON})"
|
||||
fi
|
||||
}
|
30
hyperterm/core/languages.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
###################
|
||||
# Message functions
|
||||
###################
|
||||
|
||||
# firts arguments is spanish
|
||||
# second arguments is english
|
||||
|
||||
function msg() {
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
printf '%s\n' "$1"
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' "$2"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function msg_err() {
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
printf '%s\n' "$1" >&2
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' "$2" >&2
|
||||
;;
|
||||
esac
|
||||
}
|
25
hyperterm/core/status.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# System Status
|
||||
function exitstatus(){
|
||||
local retval=$?
|
||||
unset status
|
||||
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
case $retval in
|
||||
0)
|
||||
status="[${retval}]"
|
||||
printf '%b%s' "${BOLD}${CYAN}" "${status}"
|
||||
;;
|
||||
1)
|
||||
status="[${retval}]"
|
||||
printf '%b%s' "${BOLD}${PURPLE}" "${status}"
|
||||
;;
|
||||
*)
|
||||
status="[${retval}]"
|
||||
printf '%b%s' "${BOLD}${RED}" "${status}"
|
||||
;;
|
||||
esac
|
||||
}
|
161
hyperterm/core/update.sh
Normal file
@ -0,0 +1,161 @@
|
||||
#!/bin/bash
|
||||
# shellcheck source=/dev/null
|
||||
#------------------
|
||||
# Update functions
|
||||
#------------------
|
||||
function _which() {
|
||||
command -v "$1" &> /dev/null
|
||||
}
|
||||
|
||||
# Check URL's
|
||||
# ---------------------
|
||||
function _url_exists() {
|
||||
if _which wget; then
|
||||
if wget --spider "$1" 2>/dev/null; then
|
||||
return 0 # URL 'ok'
|
||||
else
|
||||
return 1 # URL 'fail'
|
||||
fi
|
||||
elif _which curl; then
|
||||
if curl --output /dev/null --silent --head --fail "$1"; then
|
||||
return 0 # URL 'ok'
|
||||
else
|
||||
return 1 # URL 'fail'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function _urls() {
|
||||
URL_1="https://git.sr.ht/~heckyel/hyperterm"
|
||||
URL_2="https://notabug.org/heckyel/hyperterm"
|
||||
|
||||
if [[ $(_url_exists "$URL_1") -eq 0 ]]; then
|
||||
URL="$URL_1"
|
||||
RAW="$URL_1/blob/master"
|
||||
elif [[ $(_url_exists "$URL_2") -eq 0 ]]; then
|
||||
URL="$URL_2"
|
||||
RAW="$URL_2/raw/master"
|
||||
fi
|
||||
}
|
||||
# ----------------------
|
||||
|
||||
function ifexists_custom() {
|
||||
|
||||
_urls "$@"
|
||||
|
||||
if [ ! -e "$HOME/.hyperterm/_custom.sh" ]; then
|
||||
case $1 in
|
||||
wget) wget "$RAW/hyperterm/_custom.sh" -O "$HOME/.hyperterm/_custom.sh" ;;
|
||||
curl) curl "$RAW/hyperterm/_custom.sh" -o "$HOME/.hyperterm/_custom.sh" ;;
|
||||
git) cp -v /tmp/hyperterm/hyperterm/_custom.sh "$HOME/.hyperterm/" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
function updbashrc() {
|
||||
|
||||
_urls "$@"
|
||||
|
||||
# data integration
|
||||
if _which wget; then
|
||||
wget -nv "$RAW/hyperterm/hyperterm.sha512" -O "$HOME/.hyperterm/hyperterm.sha512" &> /dev/null
|
||||
ifexists_custom wget &> /dev/null
|
||||
elif _which curl; then
|
||||
curl "$RAW/hyperterm/hyperterm.sha512" -o "$HOME/.hyperterm/hyperterm.sha512" &> /dev/null
|
||||
ifexists_custom curl &> /dev/null
|
||||
fi
|
||||
|
||||
# checksum of data verification
|
||||
(cd "$HOME/.hyperterm/" && sha512sum -c hyperterm.sha512 &> /dev/null)
|
||||
_interger=$?
|
||||
|
||||
if _which git; then
|
||||
if [[ "$_interger" -eq 0 ]]; then
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
printf '%b' "${BOLD}${CYAN}"
|
||||
printf '%s\n' ' __ __ ______ '
|
||||
printf '%s\n' ' / / / /_ ______ ___ ____/_ __/__ _________ ___ '
|
||||
printf '%s\n' ' / /_/ / / / / __ \/ _ \/ ___// / / _ \/ ___/ __ `__ \ '
|
||||
printf '%s\n' ' / __ / /_/ / /_/ / __/ / / / / __/ / / / / / / / '
|
||||
printf '%s\n' ' /_/ /_/\__, / .___/\___/_/ /_/ \___/_/ /_/ /_/ /_/ '
|
||||
printf '%s\n' ' /____/_/ '
|
||||
printf '%s\n' ' '
|
||||
printf '%b' "${BOLD}${GREY}"
|
||||
msg "¡Hurra! HyperTerm se ha actualizado y/o está en la versión actual." \
|
||||
"Hooray! HyperTerm has been updated and/or is at the current version."
|
||||
|
||||
msg "Consigue tu copia de HyperTerm en: https://notabug.org/heckyel/hyperterm" \
|
||||
"Get your HyperTerm swag at: https://notabug.org/heckyel/hyperterm"
|
||||
printf '%b\n' "$RESET"
|
||||
else
|
||||
if [[ $(_url_exists "$URL") -eq 0 ]]; then
|
||||
# clone '--depth=1' not support cgit
|
||||
(git clone $URL /tmp/hyperterm/ --depth=1 &> /dev/null)
|
||||
printf '%s\r' "##### (33%)"
|
||||
sleep 1
|
||||
# core
|
||||
for i in autocomplete.sh colors.sh git.sh languages.sh status.sh update.sh; do
|
||||
install -m644 /tmp/hyperterm/hyperterm/core/$i "$HOME/.hyperterm/core/$i"
|
||||
done
|
||||
# themes
|
||||
for i in default.sh joy.sh light_theme.sh pure.sh special.sh; do
|
||||
install -m644 /tmp/hyperterm/hyperterm/themes/$i "$HOME/.hyperterm/themes/$i"
|
||||
done
|
||||
# tools
|
||||
(cp -f /tmp/hyperterm/hyperterm/tools/* "$HOME/.hyperterm/tools/" &> /dev/null)
|
||||
|
||||
for i in hyperterm.sh hyperterm.sha512; do
|
||||
install -m644 /tmp/hyperterm/hyperterm/$i "$HOME/.hyperterm/$i"
|
||||
done
|
||||
(cp -f /tmp/hyperterm/.bash_profile "$HOME/" &> /dev/null)
|
||||
printf '%s\r' "############# (66%)"
|
||||
(ifexists_custom git &> /dev/null)
|
||||
sleep 1
|
||||
(rm -fr /tmp/hyperterm/)
|
||||
printf '%s\n' "####################### (100%) done!"
|
||||
source "$HOME/.bashrc"
|
||||
else
|
||||
msg_err "El repo esta deshabilitado o no hay conexión a Internet" \
|
||||
"The repo is disabled or connection failed"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
msg_err "No hay curl y git. Por favor, instale los programas para actualizar HyperTerm" \
|
||||
"I couldn't find not curl and git. Please, install the programs to update HyperTerm"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function updbashrc_custom() {
|
||||
|
||||
_urls "$@"
|
||||
|
||||
if [[ $(_url_exists "$URL") -eq 0 ]]; then
|
||||
while true
|
||||
do
|
||||
function _copy_c() {
|
||||
if _which wget; then
|
||||
wget "$RAW/hyperterm/_custom.sh" -O "$HOME/.hyperterm/_custom.sh"; source "$HOME/.bashrc"
|
||||
elif _which curl; then
|
||||
curl "$RAW/hyperterm/_custom.sh" -o "$HOME/.hyperterm/_custom.sh"; source "$HOME/.bashrc"
|
||||
fi
|
||||
}
|
||||
|
||||
question=$(msg "¿Estás seguro de sobre-escribir _custom.sh? [s/N]: " \
|
||||
"Are you sure to overwrite _custom.sh? [y/N]: ")
|
||||
read -r -p "$question" input
|
||||
case $input in
|
||||
[sS]|[yY]) _copy_c "$@"; break ;;
|
||||
[nN]|"") break ;;
|
||||
*) msg "Por favor responde sí o no" \
|
||||
"Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
else
|
||||
msg_err "El repo esta deshabilitado o no hay conexión a Internet" \
|
||||
"The repo is disabled or connection failed"
|
||||
return 1
|
||||
fi
|
||||
}
|
75
hyperterm/hyperterm.sh
Normal file
@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Custom Prompt Shell
|
||||
#
|
||||
# $HOME/.bashrc
|
||||
#
|
||||
# License: GNU GPLv3 or later
|
||||
# See archive AUTHORS
|
||||
#
|
||||
# shellcheck disable=SC1090
|
||||
|
||||
xhost +local:root > /dev/null 2>&1
|
||||
|
||||
#---------------
|
||||
# Check bash
|
||||
#---------------
|
||||
if [[ ! -f /bin/bash ]]; then
|
||||
if [[ $(command -v bash) != /bin/bash ]]; then
|
||||
printf '%s\n' "/bin/bash not found. Please run 'sudo ln -s $(command -v bash) /bin/bash'"
|
||||
fi
|
||||
fi
|
||||
|
||||
#---------------
|
||||
# Emacs support
|
||||
#---------------
|
||||
[ "$TERM" = "dumb" ] && export PAGER=/bin/cat
|
||||
|
||||
#----------------
|
||||
# bash_aliases
|
||||
#----------------
|
||||
if [[ -f $HOME/.hyperterm/tools/aliases.sh ]]; then source "$HOME/.hyperterm/tools/aliases.sh"; else true; fi
|
||||
|
||||
#----------------
|
||||
# bash_functions
|
||||
#----------------
|
||||
# [ core ]
|
||||
if [[ -f $HOME/.hyperterm/core/autocomplete.sh ]]; then source "$HOME/.hyperterm/core/autocomplete.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/core/colors.sh ]]; then source "$HOME/.hyperterm/core/colors.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/core/git.sh ]]; then source "$HOME/.hyperterm/core/git.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/core/languages.sh ]]; then source "$HOME/.hyperterm/core/languages.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/core/status.sh ]]; then source "$HOME/.hyperterm/core/status.sh"; else true; fi
|
||||
if [[ -f $HOME/.hyperterm/core/update.sh ]]; then source "$HOME/.hyperterm/core/update.sh"; else true; fi
|
||||
|
||||
#-------------
|
||||
# Theme
|
||||
#-------------
|
||||
if [[ -f $HOME/.hyperterm/themes/default.sh ]]; then source "$HOME/.hyperterm/themes/default.sh"; else true; fi
|
||||
|
||||
#--------------
|
||||
# bashrc_custom
|
||||
#--------------
|
||||
if [[ -f $HOME/.hyperterm/_custom.sh ]]; then source "$HOME/.hyperterm/_custom.sh"; else true; fi
|
||||
|
||||
#---------------
|
||||
# Shell prompt
|
||||
#---------------
|
||||
if [[ -d $HOME/.hyperterm && -f $HOME/.hyperterm/_custom.sh && -s $HOME/.hyperterm/_custom.sh ]]; then
|
||||
PS1="${prompt:=$prompt}"
|
||||
elif [[ -d $HOME/.hyperterm ]]; then
|
||||
PS1="${prompt:=$default}"
|
||||
else
|
||||
PS1='[\u@\h \W]\$ '
|
||||
fi
|
||||
#Interactive Prompt
|
||||
PS2="${_psi:=$_psi}"
|
||||
|
||||
# global unsets
|
||||
unset SYMBOL prompt _psi
|
||||
|
||||
# clean up themes
|
||||
unset default light_theme minterm pure special
|
||||
|
||||
# clean up colors
|
||||
unset BLUE CYAN GREEN GREY LEMON ORANGE PURPLE \
|
||||
RED WHITE YELLOW BOLD RESET
|
26
hyperterm/hyperterm.sha512
Normal file
@ -0,0 +1,26 @@
|
||||
d02b066e31cd063596fa18e47fd1d5c1f1a19b96c08285b96c1991eb95ff52e9e5096e529540222b3be30ff94726170ecf05cd9c554da137ed2baf7d248773c5 ../.bash_profile
|
||||
a78784d5e732b907fc4cb4fdd817b94096f11d49acee2c26887247e924f01f363331318ea50a2235156ef43c1fec9148f49968308fe325cd90a2308b2798413c ./tools/export.sh
|
||||
6f08ba1ca2f88ae12ab37bb809ce2408b39cc69c05bffb2015661b39761aaf3f50eef52f0f0779a7143c0990fd0a35696203dd7f023c2119597d57f23612f587 ./tools/virtualenv.sh
|
||||
88b215a6c2df22bc84bda981b3ff1d27ba391f03e2b84b95adefe1e8885b079b0da7c885ec0ad3256b60b8da9efa9ba8ab28906ece76781b192ea474d579d143 ./tools/rar2zip.sh
|
||||
81572df762582dc63ca7ce89a0aeed645931011b0d66909d9ac6c5d34d6e16ddab6a1edd385ac9328b11bb154fb6ecbe93f15c0396a0f33f6dcf4557cb430a02 ./tools/ssh-agent.sh
|
||||
73becd983f15d68b3c459adb4fe847bbbd6343519640aa5e03bb530e61a59ed0545dd3b3621ad82da378bbf15c4d9ee63984004d3bfed26d9d9df643f1524de5 ./tools/proxy.sh
|
||||
24ee7d176c3ee9e7080e1cc87d02f709d95bfcaad098843ff2d7de5168f8c7559a5ac79fd0da2ce81233ecbcf0b4b776aa60b6603020698482f45b080289fc4c ./tools/aliases.sh
|
||||
ee1d6d1f9b010318985f7154c2a9173c8f2ab6b637cd3c8d2a9b403e83470e15a273dcff326a84f035660807d7cfcf04efe5abc0495e25ae7339b8807899cf0d ./tools/listuser.sh
|
||||
a24eb94b5542e340c186acd3537d3e144b1de9e08f0cb502988959a5920133e702b598a2af714a2f81a0d475573431dd95509542e34bfb09cc5cb71bbeb1bd70 ./tools/sysinfo.sh
|
||||
1d26185a78a0a779af61cdf816f0644bbd328588800ead4dcf5475b0750704fd01755edcf12048791d23cb94afae8512ef587135ff049b84c5a5c0eb0d2209a6 ./tools/compress.sh
|
||||
cef212bc908eb64ddc606da86ac71f3f526369046b2292ba8884385d267cc07b2d93c8fb4f2de1dfb0d1a6f9eed028639b83da6cc854d0cd2bfb259434e09236 ./tools/vconverter.sh
|
||||
579852abd8378d754fcaccb903c1fefcd4020a578ba63fb3687a08027a937fbbd18e8a1ac22b448edc14445e088134e1e909ae2f3bfea8702df8abf56000daa0 ./tools/ruby.sh
|
||||
feff7e1dc5d3a84761495979eaf091dc2132fa081c3b4501756973a25e0514e9a00cc9a201767bac7d391eaee631777bbbd9bc032110e99da099c33f710a4c9f ./tools/network.sh
|
||||
7447d3e167ab207d3ef4218e201a06bf5a3fc23281639f16f7f405f1d66b73923845d450fdb0a94672757866a9da0324f728564a1b61b2ed1678fe576eb565cf ./core/autocomplete.sh
|
||||
065cfa39f1b4312ed275ad1039827a24f703176c653a8d27303d145f9d389a60ec5b3a9eb167e060cc6fd093b9c03cfb1a8b70254d444fbc6e62e2297d88b310 ./core/status.sh
|
||||
5a362d89d5ccec7861fb33856b17e111ca95000752029529aaaa1182ca65dd84016debfec1b5a20a8f9bf43c141439fd070bc7363b82db09466dfd7cfd0b1a16 ./core/git.sh
|
||||
a1c486c9cc0e623796291607d1967e98a585757ae2bd4daccd7b594d6c3ca32d14c1bde087d1edcb9a741a4748f6635ad4c381b4f8a2b86844ac7c8ef830e5e4 ./core/update.sh
|
||||
f3e00b2aa8ab9f3ab44570adaa2520408ed66fd00f551654d60b64a4be3546ec781b7efa39bcd774937e654b6ffb4c7af3f21eeb36caf9c01f82f85cf28e2b4d ./core/languages.sh
|
||||
1cfba599047d84a17ff92b695ebf527a505a30acc9ec21a2b9f410a7ea6dde4b23b5cf62e557d82f2fe9a8980649942424b879ca53baae4d4cb3057681baa7b6 ./core/colors.sh
|
||||
ab3089453e35cc38544dffe672d532cbd559634937893a053937b599175688aecc5f3caad3064e818b883b027f27713194e3909dc3ab0246922cea00557c595a ./hyperterm.sh
|
||||
8b5504c1545ff59c18af208afe6e56e5779522bfc30f96509ad88db81c183c636d2f60e9702f5d678dab610f45e31aa3ed86e379ec9b816fcc84dd6222c92014 ./themes/pure.sh
|
||||
179063519b197ffac74078b3b4f8b7268b30c9b22c62dfb6885241cb06b08cfec55c017b48eefc44da96bc190840e4a435ab0468e768c37ccce0ff09f0212c00 ./themes/special.sh
|
||||
050c5ca8df1c0833631f2d2783cb942c0d77417070f921fca7b2e82031d8b9bc2933e2a492dd8ff5a5dbcea6ff851670a398f942209e83fc4e7305c05aff70ad ./themes/minterm.sh
|
||||
22348e57d560199b01b11ecddeb4918c7740cd2afd12780c91bed94bcabe9d8f6c9d15b4dc77ee5550944274a8e755d79734d1264dc129bba05e12de528cd174 ./themes/default.sh
|
||||
fad1010c202abf2ef0bb00d74d829412c1f9459b93af870ca2f5e3e3e96105fe3f5e0c8a7aa87ad6b138439360788c4740330bd6449bfc2df28a14f8550408c9 ./themes/light_theme.sh
|
||||
753feb7860eabcf22a121771028e73978b63064a9cb0e84a9a8c2727d5133b21275ee38b6517fc68aaf7aaa49382723f6b40e5bf2e2ad36e5f041c8cafa06aa0 ./themes/joy.sh
|
27
hyperterm/themes/default.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1117
|
||||
|
||||
unset default
|
||||
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
default=("\n\
|
||||
\[$RESET\]\
|
||||
\[${BOLD}${YELLOW}\][ \u \
|
||||
\[${BOLD}${BLUE}\]| \D{%Y-%m-%d} |\
|
||||
\[${BOLD}${RED}\] \D{%I:%M%p} ]\n\
|
||||
\[$RESET\]\
|
||||
\[${BOLD}${WHITE}\][\$PWD]\[$RESET\] \
|
||||
\$(exitstatus)\[$RESET\]\
|
||||
\$( _prompt_is_on_git &> /dev/null && \
|
||||
echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \
|
||||
echo -n \"\$(_prompt_get_git_info)\" && \
|
||||
echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \
|
||||
echo -n \"\[$RESET\]\")\
|
||||
\n\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]")
|
||||
|
||||
export default
|
||||
|
||||
unset _psi
|
||||
: "${_psi:=\[${BOLD}${CYAN}\]=>\[$RESET\] }"
|
33
hyperterm/themes/joy.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
unset joy
|
||||
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
: "${joy:=\n\
|
||||
\[${BOLD}${CYAN}\]\342\224\214\342\224\200[\
|
||||
\[${BOLD}${YELLOW}\]\u\
|
||||
\[${BOLD}${CYAN}\]@\
|
||||
\[${BOLD}${GREY}\]\h\
|
||||
\[${BOLD}${CYAN}\]]\
|
||||
\342\224\200[\
|
||||
\[${RESET}\]\w\
|
||||
\[${BOLD}${CYAN}\]]\
|
||||
\342\224\200\
|
||||
\$(exitstatus)\
|
||||
\[${BOLD}${CYAN}\]\
|
||||
\342\224\200\
|
||||
\$( _prompt_is_on_git &> /dev/null && \
|
||||
echo -n \"\[$RESET\]\" && \
|
||||
echo -n \"\$(_prompt_get_git_info)\" && \
|
||||
echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \
|
||||
echo -n \"\[$RESET\]\")\
|
||||
\[${BOLD}${CYAN}\]\342\224\200[\
|
||||
\[${RESET}\]\t\
|
||||
\[${BOLD}${CYAN}\]]\n\
|
||||
\[${BOLD}${CYAN}\]\342\224\224\342\224\200\342\224\200\342\225\274\
|
||||
\[${BOLD}${GREEN}\] $SYMBOL \[$RESET\]}"
|
||||
|
||||
unset _psi
|
||||
: "${_psi:=\[${BOLD}${CYAN}\]=>\[$RESET\] }"
|
24
hyperterm/themes/light_theme.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
unset light_theme
|
||||
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
: "${light_theme:=\n\
|
||||
\[$RESET\]\
|
||||
\[${BOLD}${CYAN}\]┌─\[$RESET\]\
|
||||
\[${BOLD}${YELLOW}\]\u\[$RESET\]\
|
||||
\[${BOLD}${CYAN}\]@\[$RESET\]\
|
||||
\[${BOLD}${GREY}\]\h\[$RESET\] \
|
||||
\$(exitstatus)\[$RESET\] \
|
||||
\[${BOLD}${WHITE}\][\$PWD]\
|
||||
\$( _prompt_is_on_git &> /dev/null && \
|
||||
echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \
|
||||
echo -n \"\$(_prompt_get_git_info)\" && \
|
||||
echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \
|
||||
echo -n \"\[$RESET\]\")\
|
||||
\n\[${BOLD}${CYAN}\]╰─➤\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]}"
|
||||
|
||||
unset _psi
|
||||
: "${_psi:=\[${BOLD}${CYAN}\]=>\[$RESET\] }"
|
25
hyperterm/themes/minterm.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
unset minterm
|
||||
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
: "${minterm:=\n\
|
||||
\[${BOLD}${CYAN}\]┌─\
|
||||
\[${BOLD}${YELLOW}\]\u\
|
||||
\[${BOLD}${CYAN}\]@\
|
||||
\[${BOLD}${GREY}\]\h\[$RESET\] \
|
||||
\$(exitstatus)\[$RESET\] \
|
||||
\[${BOLD}${WHITE}\][\$PWD]\
|
||||
\$( _prompt_is_on_git &> /dev/null && \
|
||||
echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \
|
||||
echo -n \"\$(_prompt_get_git_info)\" && \
|
||||
echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \
|
||||
echo -n \"\[$RESET\]\")\n\
|
||||
\[${BOLD}${CYAN}\]╰─➤\[$RESET\] \
|
||||
\$( echo -n \"\[${BOLD}${GREY}\]\$(date +%H:%M)\" )\[$RESET\] \
|
||||
\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]}"
|
||||
|
||||
unset _psi
|
||||
: "${_psi:=\[${BOLD}${CYAN}\]=>\[$RESET\] }"
|
23
hyperterm/themes/pure.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
unset pure
|
||||
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
: "${pure:=\
|
||||
\[${BOLD}${GREEN}\]\u\[$RESET\] \
|
||||
\[${BOLD}${YELLOW}\][\
|
||||
\[${BOLD}${RED}\]\w\
|
||||
\[${BOLD}${YELLOW}\]]\[$RESET\] \
|
||||
\$(exitstatus)\[$RESET\] \
|
||||
\[${BOLD}${BLUE}\](\$(date +%H:%M:%S))\
|
||||
\$( _prompt_is_on_git &> /dev/null && \
|
||||
echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \
|
||||
echo -n \"\$(_prompt_get_git_info)\" && \
|
||||
echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \
|
||||
echo -n \"\[$RESET\]\")\
|
||||
\n\[${BOLD}${CYAN}\]$SYMBOL \[$RESET\]}"
|
||||
|
||||
unset _psi
|
||||
: "${_psi:=\[${BOLD}${CYAN}\]=>\[$RESET\] }"
|
39
hyperterm/themes/special.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1117
|
||||
|
||||
unset special
|
||||
|
||||
# Import colors
|
||||
_colors_bash "$@"
|
||||
|
||||
_prompt_local_name() {
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
printf "Ubicación Actual:"
|
||||
;;
|
||||
*)
|
||||
printf "Current Location:"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
special=("\n\
|
||||
\[$RESET\]\
|
||||
\[${BOLD}${YELLOW}\][$(_prompt_local_name)\
|
||||
\[$RESET\] \[${BOLD}${GREY}\]\w\
|
||||
\[${BOLD}${YELLOW}\]]\[$RESET\] \
|
||||
\[${BOLD}${CYAN}\]hist:\!\[$RESET\]\n\
|
||||
\[${BOLD}${GREY}\]\
|
||||
\D{%Y-%m-%d}@\D{%I:%M%p}\[$RESET\] \
|
||||
\$(exitstatus)\[$_PROMPT_RESET\]\
|
||||
\$( _prompt_is_on_git &> /dev/null && \
|
||||
echo -n \" \[${BOLD}${WHITE}\]on\[$RESET\] \" && \
|
||||
echo -n \"\$(_prompt_get_git_info)\" && \
|
||||
echo -n \"\[${BOLD}${RED}\]\$(_get_git_progress)\" && \
|
||||
echo -n \"\[$RESET\]\")\n\
|
||||
\[${BOLD}${GREEN}\]$SYMBOL \[$RESET\]")
|
||||
|
||||
export special
|
||||
|
||||
unset _psi
|
||||
: "${_psi:=\[${BOLD}${CYAN}\]=>\[$RESET\] }"
|
12
hyperterm/tools/aliases.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
alias clean='cat /dev/null > "$HOME/.bash_history" && history -c'
|
||||
alias df='df -h' # human-readable sizes
|
||||
alias ep='emacs PKGBUILD'
|
||||
alias free='free -hm' # show sizes in humans format
|
||||
alias grep='grep --color=tty -d skip'
|
||||
alias la='ls -la --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
|
||||
alias ll='ls -l --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
|
||||
alias ls='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
|
||||
alias np='nano PKGBUILD'
|
||||
alias pastebin='curl -X POST https://bpa.st/curl -F "raw=<-"'
|
165
hyperterm/tools/compress.sh
Normal file
@ -0,0 +1,165 @@
|
||||
#!/bin/bash
|
||||
# ex - archive extractor
|
||||
# usage: ex <file>
|
||||
function ex() {
|
||||
if [ -f "$1" ] ; then
|
||||
# shellcheck disable=SC2221,SC2222
|
||||
case "$1" in
|
||||
*.tar.bz2) tar xjf "$1" ;;
|
||||
*.tar.gz) tar xzf "$1" ;;
|
||||
*.tar.xz) tar xf "$1" ;;
|
||||
*.tar.lz) tar xvf "$1" ;;
|
||||
*.lz) lzip -d "$1" ;;
|
||||
*.7z) 7z x "$1" ;;
|
||||
*.bz2) bunzip2 "$1" ;;
|
||||
*.gz) gunzip "$1" ;;
|
||||
*.rar) unar "$1" ;;
|
||||
*.tar) tar xf "$1" ;;
|
||||
*.tbz2) tar xjf "$1" ;;
|
||||
*.tgz) tar xzf "$1" ;;
|
||||
*.xz) unxz "$1" ;;
|
||||
*.Z) uncompress "$1" ;;
|
||||
*.zip) unzip "$1" ;;
|
||||
*) msg_err "No se puede extraer '$1' vía ex()" \
|
||||
"'$1' cannot be extracted via ex()"
|
||||
return 1 ;;
|
||||
esac
|
||||
else
|
||||
msg_err "'$1' no es un archivo válido ¯\_(ツ)_/¯" \
|
||||
"'$1' is not a valid file ¯\_(ツ)_/¯"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Compress files or directories
|
||||
function cex() {
|
||||
|
||||
function option_compress_f() {
|
||||
printf '%s\n' "1) 7z"
|
||||
printf '%s\n' "2) bz2"
|
||||
printf '%s\n' "3) gz"
|
||||
printf '%s\n' "4) tar.bz2"
|
||||
printf '%s\n' "5) tar.gz"
|
||||
printf '%s\n' "6) tar.xz"
|
||||
printf '%s\n' "7) tar.lz"
|
||||
printf '%s\n' "8) tar"
|
||||
printf '%s\n' "9) tbz2"
|
||||
printf '%s\n' "10) tgz"
|
||||
printf '%s\n' "11) Z"
|
||||
printf '%s\n' "12) zip"
|
||||
}
|
||||
|
||||
function option_compress_d() {
|
||||
printf '%s\n' "1) 7z"
|
||||
printf '%s\n' "2) tar.bz2"
|
||||
printf '%s\n' "3) tar.gz"
|
||||
printf '%s\n' "4) tar.xz"
|
||||
printf '%s\n' "5) tar.lz"
|
||||
printf '%s\n' "6) tar"
|
||||
printf '%s\n' "7) tbz2"
|
||||
printf '%s\n' "8) tgz"
|
||||
printf '%s\n' "9) zip"
|
||||
}
|
||||
|
||||
function log_compress() {
|
||||
msg "Que tenga un buen día \o/" \
|
||||
"You have a nice day \o/"
|
||||
}
|
||||
|
||||
function invalid_option() {
|
||||
msg "Archivo inválido u Opción no listada ¯\_(ツ)_/¯" \
|
||||
"Invalid file or Option not listed ¯\_(ツ)_/¯"
|
||||
return 1
|
||||
}
|
||||
|
||||
function compress_f() {
|
||||
read -r A
|
||||
case $A in
|
||||
1) 7z a "${1}.7z" "$1" ;;
|
||||
2) bzip2 -k "$1" ;;
|
||||
3) gzip --best --keep "$1" ;;
|
||||
4) tar -c "$1" | bzip2 > "${1}.tar.bz2" ;;
|
||||
5) tar -czvf "${1}.tar.gz" "$1" ;;
|
||||
6) tar cJvf "${1}.tar.xz" "$1" ;;
|
||||
7) tar -cvf "${1}.tar.lz" --lzip "$1" ;;
|
||||
8) tar -cvf "${1}.tar" "$1" ;;
|
||||
9) tar -c "$1" | bzip2 > "${1}.tbz2" ;;
|
||||
10) tar -czvf "${1}.tgz" "$1" ;;
|
||||
11) tar -czvf "${1}.z" "$1" ;;
|
||||
12) zip -r "${1}.zip" "$1" ;;
|
||||
0) log_compress "$@" ;;
|
||||
*) invalid_option "$@" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
function compress_d() {
|
||||
read -r A
|
||||
case $A in
|
||||
1) 7z a "${1%/}.7z" "$1" ;;
|
||||
2) tar -c "$1" | bzip2 > "${1%/}.tar.bz2" ;;
|
||||
3) tar -czvf "${1%/}.tar.gz" "$1" ;;
|
||||
4) tar cJvf "${1%/}.tar.xz" "$1" ;;
|
||||
5) tar -cvf "${1%/}.tar.lz" --lzip "${1}" ;;
|
||||
6) tar -cvf "${1%/}.tar" "$1" ;;
|
||||
7) tar -c "$1" | bzip2 > "${1%/}.tbz2" ;;
|
||||
8) tar -czvf "${1%/}.tgz" "$1" ;;
|
||||
9) zip -r "${1%/}.zip" "$1" ;;
|
||||
0) log_compress "$@" ;;
|
||||
*) invalid_option "$@" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Run
|
||||
if [[ -f "$1" ]] ; then
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
# Print viewport user
|
||||
printf '%s\n' "Elige una acción"
|
||||
option_compress_f "$@"
|
||||
printf '%s\n' "0) salir"
|
||||
printf "Inserta la opción aquí:"
|
||||
compress_f "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
# Print viewport user
|
||||
printf '%s\n' "Choose option"
|
||||
option_compress_f "$@"
|
||||
printf '%s\n' "0) exit"
|
||||
printf "Insert the option here:"
|
||||
compress_f "$@"
|
||||
;;
|
||||
esac
|
||||
elif [[ -d "$1" ]] ; then
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
# Print viewport user
|
||||
printf '%s\n' "Elige una acción"
|
||||
option_compress_d "$@"
|
||||
printf '%s\n' "0) salir"
|
||||
printf "Inserta la opción aquí:"
|
||||
compress_d "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
# Print viewport user
|
||||
printf '%s\n' "Choose option"
|
||||
option_compress_d "$@"
|
||||
printf '%s\n' "0) exit"
|
||||
printf "Insert the option here:"
|
||||
compress_d "$@"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
msg_err "'$1' no es un archivo o directorio válido ¯\_(ツ)_/¯" \
|
||||
"'$1' is not a valid file or directory ¯\_(ツ)_/¯"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
unset -f compress_f
|
||||
unset -f compress_d
|
||||
unset -f log_compress
|
||||
unset -f option_compress_f
|
||||
unset -f option_compress_d
|
||||
unset -f invalid_option
|
6
hyperterm/tools/export.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
export HISTSIZE=10000
|
||||
export HISTFILESIZE=${HISTSIZE}
|
||||
export HISTCONTROL=ignoreboth
|
||||
export JAVA_FONTS=/usr/share/fonts/TTF
|
17
hyperterm/tools/listuser.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# List user
|
||||
function listuser() {
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
printf '%s\n' "Usuario UID Shell "
|
||||
printf '%s\n' "----------- ----- --------"
|
||||
awk -F':' '$3>=1000 && $3<=60000 { printf "%-12s %4d %11s\n", $1, $3, $7 | "sort -r"}' /etc/passwd
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' "Users UID Shell "
|
||||
printf '%s\n' "----------- ----- --------"
|
||||
awk -F':' '$3>=1000 && $3<=60000 { printf "%-12s %4d %11s\n", $1, $3, $7 | "sort -r"}' /etc/passwd
|
||||
;;
|
||||
esac
|
||||
}
|
11
hyperterm/tools/network.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Network
|
||||
function my_ip() {
|
||||
unset MY_IP
|
||||
: "${MY_IP:=$(ip route show table local | awk -F "local" '{print $2}' | uniq)}"
|
||||
}
|
||||
|
||||
function my_isp() {
|
||||
unset MY_ISP
|
||||
: "${MY_ISP:=$(host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}')}"
|
||||
}
|
47
hyperterm/tools/proxy.sh
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
function proxy_on() {
|
||||
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
|
||||
|
||||
if (( $# > 0 )); then
|
||||
valid=$(echo "$@" | sed -n 's/\([0-9]\{1,3\}.\)\{4\}:\([0-9]\+\)/&/p')
|
||||
value=$("$@")
|
||||
if [[ $valid != "$value" ]]; then
|
||||
>&2 echo "Invalid address"
|
||||
return 1
|
||||
fi
|
||||
|
||||
export http_proxy="http://$1/"
|
||||
export https_proxy=$http_proxy
|
||||
export ftp_proxy=$http_proxy
|
||||
export rsync_proxy=$http_proxy
|
||||
echo "Proxy environment variable set."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo -n "username: "; read -r username
|
||||
if [[ $username != "" ]]; then
|
||||
echo -n "password: "
|
||||
read -esr password
|
||||
local pre="$username:$password@"
|
||||
fi
|
||||
|
||||
echo -n "server: "; read -r server
|
||||
echo -n "port: "; read -r port
|
||||
export http_proxy="http://$pre$server:$port/"
|
||||
export https_proxy=$http_proxy
|
||||
export ftp_proxy=$http_proxy
|
||||
export rsync_proxy=$http_proxy
|
||||
export HTTP_PROXY=$http_proxy
|
||||
export HTTPS_PROXY=$http_proxy
|
||||
export FTP_PROXY=$http_proxy
|
||||
export RSYNC_PROXY=$http_proxy
|
||||
}
|
||||
|
||||
function proxy_off(){
|
||||
unset http_proxy
|
||||
unset https_proxy
|
||||
unset ftp_proxy
|
||||
unset rsync_proxy
|
||||
echo -e "Proxy environment variable removed."
|
||||
}
|
58
hyperterm/tools/rar2zip.sh
Normal file
@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# rar2zip conversion script
|
||||
#
|
||||
# Usage: rar2zip file [file ...]
|
||||
# Example: rar2zip file.rar
|
||||
|
||||
function rar2zip() {
|
||||
|
||||
echo "Converting RARs to ZIPs"
|
||||
|
||||
# Use RAM disk for temporary files.
|
||||
WORKDIR="/dev/shm/"
|
||||
|
||||
for INFILE in "$@"; do
|
||||
# Absolute path to old file
|
||||
OLDFILE=$(realpath "${INFILE}")
|
||||
|
||||
# Get the file name without the extension
|
||||
BASENAME=$(basename "${OLDFILE%.*}")
|
||||
|
||||
# Path for the file. The ".zip" file will be written there.
|
||||
DIRNAME=$(dirname "$OLDFILE")
|
||||
|
||||
# Name of the .zip file
|
||||
NEWNAME="${DIRNAME}/$BASENAME.zip"
|
||||
|
||||
if [ ! -e "${NEWNAME}" ]; then
|
||||
# Set name for the temp dir. This directory will be created under WORKDIR
|
||||
TEMPDIR=$(mktemp -p "$WORKDIR" -d)
|
||||
|
||||
# Create a temporary folder for unRARed files
|
||||
echo "Extracting $OLDFILE"
|
||||
|
||||
unar "$OLDFILE" -o "${TEMPDIR}/"
|
||||
|
||||
# Zip the files with maximum compression
|
||||
7z a -tzip -mx=9 "$NEWNAME" "${TEMPDIR}/*"
|
||||
# Alternative. MUCH SLOWER, but better compression
|
||||
# 7z a -mm=Deflate -mfb=258 -mpass=15 -r "$NEWNAME" *
|
||||
|
||||
# Preserve file modification time
|
||||
touch -r "$OLDFILE" "$NEWNAME"
|
||||
|
||||
# Delete the temporary directory
|
||||
rm -r "$TEMPDIR"
|
||||
|
||||
# OPTIONAL. Safe-remove the old file
|
||||
# Restore from "$HOME/.local/share/Trash"
|
||||
gio trash "$OLDFILE"
|
||||
echo "${OLDFILE}: A backup was made on $HOME/.local/share/Trash"
|
||||
else
|
||||
echo "${NEWNAME}: File exists!"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Conversion Done"
|
||||
}
|
10
hyperterm/tools/ruby.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -x /usr/bin/ruby ]; then
|
||||
# Variable de Entorno para Sass
|
||||
# Sass
|
||||
_ruby="$(ruby -r rubygems -e "puts Gem.user_dir")/bin"
|
||||
if [ -s "$_ruby" ]; then
|
||||
export PATH+=:$_ruby
|
||||
fi
|
||||
fi
|
105
hyperterm/tools/ssh-agent.sh
Normal file
@ -0,0 +1,105 @@
|
||||
#!/bin/bash
|
||||
|
||||
#------------
|
||||
# SSH-AGENT
|
||||
#------------
|
||||
function sshagent_start {
|
||||
|
||||
# clean previous ssh credentials
|
||||
(rm -rf /tmp/ssh-* > /dev/null)
|
||||
|
||||
SSH_ENV="$HOME/.ssh/environment"
|
||||
printf '\e[1;36m%s\e[m\n' "Initialising new SSH agent..."
|
||||
ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
|
||||
chmod 600 "${SSH_ENV}"
|
||||
# shellcheck source=/dev/null
|
||||
source "${SSH_ENV}" > /dev/null
|
||||
ssh-add -t 5d
|
||||
printf '\e[1;36m%s\e[m\n' "succeeded"
|
||||
}
|
||||
|
||||
function sshagent_stop {
|
||||
|
||||
# clean previous ssh credentials
|
||||
(rm -rf /tmp/ssh-* > /dev/null)
|
||||
|
||||
ssh-agent -k > /dev/null
|
||||
}
|
||||
|
||||
function sshagent_findsockets {
|
||||
find /tmp -uid "$(id -u)" -type s -name agent.\* 2>/dev/null
|
||||
}
|
||||
|
||||
function sshagent_testsocket {
|
||||
if [ ! -x "$(command -v ssh-add)" ] ; then
|
||||
echo "ssh-add is not available; agent testing aborted"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ X"$1" != X ] ; then
|
||||
export SSH_AUTH_SOCK=$1
|
||||
fi
|
||||
|
||||
if [ X"$SSH_AUTH_SOCK" = X ] ; then
|
||||
return 2
|
||||
fi
|
||||
|
||||
if [ -S "$SSH_AUTH_SOCK" ] ; then
|
||||
ssh-add -l > /dev/null
|
||||
if [ $? = 2 ] ; then
|
||||
echo "Socket $SSH_AUTH_SOCK is dead! Deleting!"
|
||||
rm -f "$SSH_AUTH_SOCK"
|
||||
return 4
|
||||
else
|
||||
echo "Found ssh-agent $SSH_AUTH_SOCK"
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
echo "$SSH_AUTH_SOCK is not a socket!"
|
||||
return 3
|
||||
fi
|
||||
}
|
||||
|
||||
function sshagent_reload {
|
||||
# ssh agent sockets can be attached to a ssh daemon process or an
|
||||
# ssh-agent process.
|
||||
|
||||
AGENTFOUND=0
|
||||
|
||||
# Attempt to find and use the ssh-agent in the current environment
|
||||
if sshagent_testsocket ; then AGENTFOUND=1 ; fi
|
||||
|
||||
# If there is no agent in the environment, search /tmp for
|
||||
# possible agents to reuse before starting a fresh ssh-agent
|
||||
# process.
|
||||
if [ $AGENTFOUND = 0 ] ; then
|
||||
for agentsocket in $(sshagent_findsockets) ; do
|
||||
if [ $AGENTFOUND != 0 ] ; then break ; fi
|
||||
if sshagent_testsocket "$agentsocket" ; then AGENTFOUND=1 ; fi
|
||||
done
|
||||
fi
|
||||
|
||||
# If at this point we still haven't located an agent, it's time to
|
||||
# start a new one
|
||||
if [ $AGENTFOUND = 0 ] ; then
|
||||
eval "$(ssh-agent)"
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
unset AGENTFOUND
|
||||
unset agentsocket
|
||||
|
||||
# Finally, show what keys are currently in the agent
|
||||
ssh-add -l
|
||||
}
|
||||
|
||||
if [[ -f "$HOME/.ssh/environment" ]]; then
|
||||
sshagent_reload > /dev/null
|
||||
fi
|
||||
|
||||
# Alias agents
|
||||
alias sagent_start="sshagent_start"
|
||||
alias sagent_stop="sshagent_stop"
|
||||
|
||||
# Clean up not global functions
|
||||
unset -f sshagent_findsockets sshagent_testsocket
|
36
hyperterm/tools/sysinfo.sh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# System information
|
||||
function ii() {
|
||||
|
||||
my_ip "$1" &> /dev/null
|
||||
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
printf '%s\e[1;36m%s\e[m\n' "Has iniciado sesión en " "$(hostname -f)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Información adicional:" "$(uname -a)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Usuarios Conectados:" "$(who -u)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Fecha actual:" "$(date)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Estadísticas de la máquina:" "$(uptime)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Estadísticas de la memoria:" "$(free)"
|
||||
printf '\n\e[1;32m%s\e[m\n' "Dirección IP Local:"
|
||||
printf '%s\n' "${MY_IP:-"No conectado"}"
|
||||
my_isp "$1" &> /dev/null
|
||||
printf '\n\e[1;32m%s\e[m\n' "Dirección ISP:"
|
||||
printf '%s\n' "${MY_ISP:-"No conectado"}"
|
||||
;;
|
||||
*)
|
||||
printf '%s\e[1;36m%s\e[m\n' "You are logged on " "$(hostname -f)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Additionnal information:" "$(uname -a)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Users logged:" "$(who -u)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Current date:" "$(date)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Machine stats:" "$(uptime)"
|
||||
printf '\n\e[1;32m%s\e[m\n%s\n' "Memory stats:" "$(free)"
|
||||
printf '\n\e[1;32m%s\e[m\n' "Local IP Address:"
|
||||
printf '%s\n' "${MY_IP:-"Not connected"}"
|
||||
my_isp "$1" &> /dev/null
|
||||
printf '\n\e[1;32m%s\e[m\n' "ISP Address:"
|
||||
printf '%s\n' "${MY_ISP:-"Not connected"}"
|
||||
;;
|
||||
esac
|
||||
}
|
72
hyperterm/tools/vconverter.sh
Normal file
@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Converter videos to WebM-VP9
|
||||
# ------------------------------
|
||||
function vtovp9() {
|
||||
|
||||
if [[ -f "$1" && -x "$(command -v ffmpeg)" ]] ; then
|
||||
case "$1" in
|
||||
*.asf) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.asf}".webm ;;
|
||||
*.avi) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.avi}".webm ;;
|
||||
*.flv) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.flv}".webm ;;
|
||||
*.mkv) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.mkv}".webm ;;
|
||||
*.mov) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.mov}".webm ;;
|
||||
*.mp4) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.mp4}".webm ;;
|
||||
*.mpg) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.mpg}".webm ;;
|
||||
*.ogv) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.ogv}".webm ;;
|
||||
*.webm) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.webm}".webm ;;
|
||||
*.wmv) ffmpeg -i "$1" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${1%.wmv}".webm ;;
|
||||
*) msg_err "El formato de '$1' no esta listado :(" \
|
||||
"The format of '$1' is not listed :("
|
||||
return 1 ;;
|
||||
esac
|
||||
else
|
||||
msg_err "Error, este no es un archivo de vídeo válido" \
|
||||
"Error, this is not a valid video file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Converter all videos to WebM-VP9
|
||||
# --------------------------------
|
||||
function alltovp9() {
|
||||
|
||||
if [[ -x "$(command -v rename)" ]]; then
|
||||
# lowercase
|
||||
for j in ASF AVI FLV MKV MOV MP4 MPG M2TS OGV VOB WMV ;
|
||||
do
|
||||
rename ."$j" ."${j,,}" -- *."$j" 2&> /dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
|
||||
if [[ -x "$(command -v ffmpeg)" ]]; then
|
||||
for FILE_NAME in *
|
||||
do
|
||||
if [[ -f "$FILE_NAME" ]]; then
|
||||
case "$FILE_NAME" in
|
||||
*.asf) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.asf}".webm ;;
|
||||
*.avi) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.avi}".webm ;;
|
||||
*.flv) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.flv}".webm ;;
|
||||
*.mkv) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.mkv}".webm ;;
|
||||
*.mov) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.mov}".webm ;;
|
||||
*.mp4) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.mp4}".webm ;;
|
||||
*.mpg) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.mpg}".webm ;;
|
||||
*.m2ts) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.m2ts}".webm ;;
|
||||
*.ogv) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.ogv}".webm ;;
|
||||
*.vob) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.vob}".webm ;;
|
||||
*.wmv) ffmpeg -i "$FILE_NAME" -c:v libvpx-vp9 -crf 33 -threads 8 -b:v 0 -b:a 128k -c:a libopus -map_metadata -1 "${FILE_NAME%.wmv}".webm ;;
|
||||
# Warnnig messages
|
||||
*.webm) printf '\e[1;36m%s\e[m\n' "Saltando '$FILE_NAME', ya está en formato WebM" ;;
|
||||
*) printf '\e[1;36m%s\e[m\n' "El formato de '$FILE_NAME' no esta listado" ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
else
|
||||
msg_err "No esta instalado ffmpeg" \
|
||||
"ffmpeg is not installed"
|
||||
return 1
|
||||
fi
|
||||
}
|
6
hyperterm/tools/virtualenv.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1090
|
||||
# Python virtualenv
|
||||
function activate() {
|
||||
source "$1/bin/activate"
|
||||
}
|
BIN
images/default.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
images/git-preview.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
images/joy.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
images/light_theme.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
images/minterm.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
images/pure.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
images/special.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
257
install.sh
Normal file
@ -0,0 +1,257 @@
|
||||
#!/bin/bash
|
||||
# shellcheck source=/dev/null
|
||||
# hyperterm installer
|
||||
# shellcheck disable=SC1117
|
||||
|
||||
# Languages
|
||||
# ---------
|
||||
function msg() {
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
echo -e "$1"
|
||||
;;
|
||||
*)
|
||||
echo -e "$2"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function msg_err() {
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
echo -e "$1" >&2
|
||||
;;
|
||||
*)
|
||||
echo -e "$2" >&2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Check URL's
|
||||
# -----------
|
||||
function _which() {
|
||||
command -v "$1" &> /dev/null
|
||||
}
|
||||
|
||||
function _url_exists() {
|
||||
if _which wget; then
|
||||
if wget --spider "$1" 2>/dev/null; then
|
||||
return 0 # URL 'ok'
|
||||
else
|
||||
return 1 # URL 'fail'
|
||||
fi
|
||||
elif _which curl; then
|
||||
if curl --output /dev/null --silent --head --fail "$1"; then
|
||||
return 0 # URL 'ok'
|
||||
else
|
||||
return 1 # URL 'fail'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function _urls() {
|
||||
URL_1="https://git.sr.ht/~heckyel/hyperterm"
|
||||
URL_2="https://notabug.org/heckyel/hyperterm"
|
||||
|
||||
if [[ $(_url_exists "$URL_1") -eq 0 ]]; then
|
||||
URL="$URL_1"
|
||||
elif [[ $(_url_exists "$URL_2") -eq 0 ]]; then
|
||||
URL="$URL_2"
|
||||
fi
|
||||
}
|
||||
# -----------
|
||||
|
||||
# Show how to use this installer
|
||||
# ------------------------------
|
||||
function show_usage() {
|
||||
msg "\n$0: Instalar HyperTerm" \
|
||||
"\n$0: Install HyperTerm"
|
||||
msg "Comando:\n$0 [argumentos] \n" \
|
||||
"Usage:\n$0 [arguments] \n"
|
||||
msg "Argumentos:" \
|
||||
"Arguments:"
|
||||
msg "--help (-h): Muestra mensaje de ayuda" \
|
||||
"--help (-h): Display this help message"
|
||||
msg "--silent (-s): Instala la configuración predeterminada sin solicitar entrada" \
|
||||
"--silent (-s): Install default settings without prompting for input"
|
||||
msg "--no-modify-config (-n): No modifica el archivo de configuración existente" \
|
||||
"--no-modify-config (-n): Do not modify existing config file"
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Clone
|
||||
#------
|
||||
function clone_new() {
|
||||
_urls "$@"
|
||||
|
||||
# clone
|
||||
msg "\e[1;32m==>\e[0m\033[1m Clonando hyperterm... \e[m" \
|
||||
"\e[1;32m==>\e[0m\033[1m Cloning hyperterm... \e[m"
|
||||
git clone "$URL" "/tmp/hyperterm/" --depth=1
|
||||
|
||||
# copy
|
||||
msg "\e[1;32m==>\e[0m\033[1m Copiando hyperterm... \e[m" \
|
||||
"\e[1;32m==>\e[0m\033[1m Copying hyperterm... \e[m"
|
||||
if [[ $silent ]]; then
|
||||
install -d -m755 "$HOME/.hyperterm/"
|
||||
cp -r /tmp/hyperterm/hyperterm/* "$HOME/.hyperterm/"
|
||||
install -m644 /tmp/hyperterm/.bash_profile "$HOME/"
|
||||
install -d -m755 "$HOME/.hyperterm/template/"
|
||||
install -m644 /tmp/hyperterm/template/bash_profile.template.bash "$HOME/.hyperterm/template/"
|
||||
else
|
||||
install -d -m755 -v "$HOME/.hyperterm/"
|
||||
cp -rv /tmp/hyperterm/hyperterm/* "$HOME/.hyperterm/"
|
||||
install -m644 -v /tmp/hyperterm/.bash_profile "$HOME/"
|
||||
install -d -m755 -v "$HOME/.hyperterm/template/"
|
||||
install -m644 -v /tmp/hyperterm/template/bash_profile.template.bash "$HOME/.hyperterm/template/"
|
||||
fi
|
||||
}
|
||||
|
||||
function clean_temp() {
|
||||
# clean up temp files
|
||||
msg "\e[1;32m==>\e[0m\033[1m Limpiando archivos temporales... \e[m" \
|
||||
"\e[1;32m==>\e[0m\033[1m Clean up temp files... \e[m"
|
||||
if [[ $silent ]]; then
|
||||
rm -rf /tmp/hyperterm/
|
||||
if [[ -f "$HOME/.hyperterm/template/bash_profile.template.bash" ]]; then
|
||||
rm -fr "$HOME/.hyperterm/template/"
|
||||
fi
|
||||
else
|
||||
rm -rfv /tmp/hyperterm/
|
||||
if [[ -f "$HOME/.hyperterm/template/bash_profile.template.bash" ]]; then
|
||||
rm -frv "$HOME/.hyperterm/template/"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Back up existing profile and create new one for hyperterm
|
||||
# ---------------------------------------------------------
|
||||
function backup_new() {
|
||||
clone_new "$@"
|
||||
test -w "$HOME/$CONFIG_FILE" &&
|
||||
cp -aL "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" &&
|
||||
msg "\033[0;36mTu archivo original $CONFIG_FILE ha sido respaldado a $CONFIG_FILE.bak \033[0m" \
|
||||
"\033[0;36mYour original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak \033[0m"
|
||||
|
||||
sed "s|{{HYPER_BASH}}|$HYPER_BASH|" "$HYPER_BASH/.hyperterm/template/bash_profile.template.bash" > "$HOME/$CONFIG_FILE"
|
||||
msg "\033[0;36mPlantilla copiada de $CONFIG_FILE dentro de ~/$CONFIG_FILE \033[0m" \
|
||||
"\033[0;36mCopied the template $CONFIG_FILE into ~/$CONFIG_FILE \033[0m"
|
||||
clean_temp "$@"
|
||||
}
|
||||
|
||||
for param in "$@"; do
|
||||
shift
|
||||
case "$param" in
|
||||
"--help") set -- "$@" "-h" ;;
|
||||
"--silent") set -- "$@" "-s" ;;
|
||||
"--no-modify-config") set -- "$@" "-n" ;;
|
||||
*) set -- "$@" "$param"
|
||||
esac
|
||||
done
|
||||
|
||||
OPTIND=1
|
||||
while getopts "hsn" opt
|
||||
do
|
||||
case "$opt" in
|
||||
"h") show_usage; exit 0 ;;
|
||||
"s") silent=true ;;
|
||||
"n") no_modify_config=true ;;
|
||||
"?") show_usage >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
HYPER_BASH="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
CONFIG_FILE=.bash_profile
|
||||
;;
|
||||
*)
|
||||
CONFIG_FILE=.bashrc
|
||||
;;
|
||||
esac
|
||||
|
||||
BACKUP_FILE=$CONFIG_FILE.bak
|
||||
msg "Instalando HyperTerm" \
|
||||
"Installing HyperTerm"
|
||||
if ! [[ $silent ]] && ! [[ $no_modify_config ]]; then
|
||||
if [ -e "$HOME/$BACKUP_FILE" ]; then
|
||||
msg_err "\033[0;36mEl archivo de respaldo ya existe. Asegúrese de hacer una copia de seguridad de su .bashrc antes de ejecutar esta instalación. \033[0m" \
|
||||
"\033[0;36mBackup file already exists. Make sure to backup your .bashrc before running this installation. \033[0m"
|
||||
while ! [ $silent ]; do
|
||||
question=$(msg "¿Desea sobrescribir la copia de seguridad existente? Esto eliminará su archivo de copia de seguridad existente ($HOME/$BACKUP_FILE) [s/N] " \
|
||||
"Would you like to overwrite the existing backup? This will delete your existing backup file ($HOME/$BACKUP_FILE) [y/N] ")
|
||||
|
||||
read -e -n 1 -r -p "$question" RESP
|
||||
case $RESP in
|
||||
[yY]|[sS])
|
||||
break
|
||||
;;
|
||||
[nN]|"")
|
||||
msg "\033[91mInstalación interrumpida. Por favor vuelve pronto!\033[m" \
|
||||
"\033[91mInstallation aborted. Please come back soon!\033[m"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
msg "\033[91mPor favor elija sí o no.\033[m" \
|
||||
"\033[91mPlease choose y or n.\033[m"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
while ! [ $silent ]; do
|
||||
question=$(msg "¿Le gustaría conservar su configuración de $CONFIG_FILE y agregar plantillas de HyperTerm al final? [s/N] " \
|
||||
"Would you like to keep your config $CONFIG_FILE and append HyperTerm templates at the end? [y/N] ")
|
||||
read -e -n 1 -r -p "$question" choice
|
||||
case $choice in
|
||||
[yY]|[sS])
|
||||
clone_new "$@"
|
||||
test -w "$HOME/$CONFIG_FILE" &&
|
||||
cp -aL "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" &&
|
||||
msg "\033[0;36mTu archivo original $CONFIG_FILE ha sido respaldado a $CONFIG_FILE.bak \033[0m" \
|
||||
"\033[0;36mYour original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak \033[0m"
|
||||
|
||||
(sed "s|{{HYPER_BASH}}|$HYPER_BASH|" "$HYPER_BASH/.hyperterm/template/bash_profile.template.bash" | tail -n +2) >> "$HOME/$CONFIG_FILE"
|
||||
msg "\033[0;36mla plantilla HyperTerm ha sido agregada a $CONFIG_FILE\033[0m" \
|
||||
"\033[0;36mHyperTerm template has been added to your $CONFIG_FILE\033[0m"
|
||||
clean_temp "$@"
|
||||
break
|
||||
;;
|
||||
[nN]|"")
|
||||
backup_new "$@"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
msg "\033[91mPor favor elija sí o no.\033[m" \
|
||||
"\033[91mPlease choose y or n.\033[m"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
elif [[ $silent ]] && ! [[ $no_modify_config ]]; then
|
||||
# backup/new by default
|
||||
backup_new "$@"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
msg "\e[1;32m==>\e[0m\033[1m Instalación finalizada con éxito! Disfrute HyperTerm! \e[m" \
|
||||
"\e[1;32m==>\e[0m\033[1m Installation finished successfully! Enjoy HyperTerm! \e[m"
|
||||
|
||||
msg "\033[0;36mPara comenzar a usarlo, abra una nueva pestaña o haga 'source $HOME/$CONFIG_FILE'.\033[0m" \
|
||||
"\033[0;36mTo start using it, open a new tab or 'source $HOME/$CONFIG_FILE'.\033[0m"
|
||||
|
||||
echo ""
|
||||
msg "¡Muchas gracias! por instalar" \
|
||||
"Thank you! for install"
|
||||
echo -e '\033[0;36m __ __ ______ '
|
||||
echo -e '\033[0;36m / / / /_ ______ ___ ____/_ __/__ _________ ___ '
|
||||
echo -e '\033[0;36m / /_/ / / / / __ \/ _ \/ ___// / / _ \/ ___/ __ `__ \ '
|
||||
echo -e '\033[0;36m / __ / /_/ / /_/ / __/ / / / / __/ / / / / / / / '
|
||||
echo -e '\033[0;36m /_/ /_/\__, / .___/\___/_/ /_/ \___/_/ /_/ /_/ /_/ '
|
||||
echo -e '\033[0;36m /____/_/ '
|
||||
echo -e '\033[m'
|
||||
msg "Para evitar problemas y mantener su shell, habilite solo las funciones que realmente desea utilizar desde $HOME/.hyperterm/_custom.sh" \
|
||||
"To avoid issues and to keep your shell lean, please enable only features you really want to use from $HOME/.hyperterm/_custom.sh"
|
||||
msg "Puede reportarnos errores en \033[0;36mhttps://notabug.org/heckyel/hyperterm/issues \033[0m" \
|
||||
"You can report errors issues in \033[0;36mhttps://notabug.org/heckyel/hyperterm/issues \033[0m"
|
8
template/bash_profile.template.bash
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# shellcheck source=/dev/null
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
# Load Hyperterm
|
||||
source "$HOME"/.hyperterm/hyperterm.sh
|
134
uninstall.sh
Normal file
@ -0,0 +1,134 @@
|
||||
#!/bin/bash
|
||||
# hyperterm uninstaller
|
||||
# shellcheck disable=SC1117
|
||||
|
||||
# Languages
|
||||
# ---------
|
||||
function msg() {
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
echo -e "$1"
|
||||
;;
|
||||
*)
|
||||
echo -e "$2"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function msg_err() {
|
||||
case ${LANG/_*/} in
|
||||
es)
|
||||
echo -e "$1" >&2
|
||||
;;
|
||||
*)
|
||||
echo -e "$2" >&2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Show how to use this uninstaller
|
||||
# --------------------------------
|
||||
function show_usage() {
|
||||
msg "\n$0: Desinstalar HyperTerm" \
|
||||
"\n$0: Uninstall HyperTerm"
|
||||
msg "Comando:\n$0 [argumentos] \n" \
|
||||
"Usage:\n$0 [arguments] \n"
|
||||
msg "Argumentos:" \
|
||||
"Arguments:"
|
||||
msg "--help (-h): Muestra mensaje de ayuda" \
|
||||
"--help (-h): Display this help message"
|
||||
msg "--silent (-s): Desinstala sin solicitar entrada" \
|
||||
"--silent (-s): Uninstall without prompting for input"
|
||||
exit 0;
|
||||
}
|
||||
|
||||
for param in "$@"; do
|
||||
shift
|
||||
case "$param" in
|
||||
"--help") set -- "$@" "-h" ;;
|
||||
"--silent") set -- "$@" "-s" ;;
|
||||
*) set -- "$@" "$param"
|
||||
esac
|
||||
done
|
||||
|
||||
OPTIND=1
|
||||
while getopts "hs" opt
|
||||
do
|
||||
case "$opt" in
|
||||
"h") show_usage; exit 0 ;;
|
||||
"s") silent=true ;;
|
||||
"?") show_usage >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
# Uninstall
|
||||
# ---------
|
||||
function _uninstall() {
|
||||
if [ -z "$HYPER_BASH" ];
|
||||
then
|
||||
HYPER_BASH="$HOME/.hyperterm"
|
||||
fi
|
||||
|
||||
case $OSTYPE in
|
||||
darwin*)
|
||||
CONFIG_FILE=.bash_profile
|
||||
;;
|
||||
*)
|
||||
CONFIG_FILE=.bashrc
|
||||
;;
|
||||
esac
|
||||
|
||||
BACKUP_FILE=$CONFIG_FILE.bak
|
||||
|
||||
if [ ! -e "$HOME/$BACKUP_FILE" ]; then
|
||||
msg_err "\033[0;33mEl archivo de respaldo $HOME/$BACKUP_FILE no fue encontrado.\033[0m" \
|
||||
"\033[0;33mBackup file $HOME/$BACKUP_FILE not found.\033[0m"
|
||||
|
||||
test -w "$HOME/$CONFIG_FILE" &&
|
||||
mv "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.uninstall" &&
|
||||
msg "\033[0;32mEl archivo $HOME/$CONFIG_FILE ha sido movido a $HOME/$CONFIG_FILE.uninstall.\033[0m" \
|
||||
"\033[0;32mMoved your $HOME/$CONFIG_FILE to $HOME/$CONFIG_FILE.uninstall.\033[0m"
|
||||
else
|
||||
test -w "$HOME/$BACKUP_FILE" &&
|
||||
cp -a "$HOME/$BACKUP_FILE" "$HOME/$CONFIG_FILE" &&
|
||||
rm "$HOME/$BACKUP_FILE" &&
|
||||
msg "\033[0;32mTu archivo original $CONFIG_FILE ha sido restaurado.\033[0m" \
|
||||
"\033[0;32mYour original $CONFIG_FILE has been restored.\033[0m"
|
||||
fi
|
||||
|
||||
if [[ -d $HOME/.hyperterm ]]; then
|
||||
rm -fr "$HOME/.hyperterm"
|
||||
fi
|
||||
|
||||
msg "\033[1;32m==>\e[0m\033[1m Desintalación realizada con éxito! \e[m" \
|
||||
"\033[1;32m==>\e[0m\033[1m Uninstallation finished successfully! \e[m"
|
||||
|
||||
msg "\033[0;32mDisculpe las molestias!! \e[m" \
|
||||
"\033[0;32mSorry to see you go!! \e[m"
|
||||
|
||||
msg "\033[1;32m==>\e[0m\033[1m Finalmente realice este paso: \e[m" \
|
||||
"\033[1;32m==>\e[0m\033[1m Final steps to complete the uninstallation: \e[m"
|
||||
|
||||
msg "\033[1;36m ->\e[0m\033[1m Abra una nueva shell/tab/terminal \e[m" \
|
||||
"\033[1;36m ->\e[0m\033[1m Open a new shell/tab/terminal \e[m"
|
||||
}
|
||||
# -------
|
||||
|
||||
if ! [[ $silent ]]; then
|
||||
while ! [ $silent ]
|
||||
do
|
||||
question=$(msg "¿Estás seguro de desinstalar HyperTerm? [s/N]: " \
|
||||
"Are you sure to uninstall HyperTerm? [y/N]: ")
|
||||
|
||||
read -r -p "$question" input
|
||||
case $input in
|
||||
[yY]|[sS]) _uninstall "$@"; break ;;
|
||||
[nN]|"") break ;;
|
||||
*) msg "Por favor responde sí o no" \
|
||||
"Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
else
|
||||
_uninstall "$@"
|
||||
fi
|