Compare commits
No commits in common. "main" and "v0.0.0" have entirely different histories.
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +0,0 @@
|
||||||
/pkg
|
|
||||||
/src
|
|
||||||
/proxyenv*.pkg.tar.*
|
|
21
LICENSE
21
LICENSE
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 Leafee98
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
30
PKGBUILD
30
PKGBUILD
|
@ -1,30 +0,0 @@
|
||||||
pkgname='proxyenv-git'
|
|
||||||
pkgver=0
|
|
||||||
pkgrel=1
|
|
||||||
arch=('any')
|
|
||||||
url="https://git.leafee98.com/leafee98/proxyenv"
|
|
||||||
pkgdesc="A cross-platform, GPU-accelerated terminal emulator"
|
|
||||||
license=('MIT')
|
|
||||||
depends=('bash')
|
|
||||||
|
|
||||||
source=(
|
|
||||||
"proxyenv"
|
|
||||||
"proxyenv.conf"
|
|
||||||
"LICENSE"
|
|
||||||
)
|
|
||||||
|
|
||||||
sha256sums=(
|
|
||||||
'SKIP'
|
|
||||||
'SKIP'
|
|
||||||
'SKIP'
|
|
||||||
)
|
|
||||||
|
|
||||||
pkgver() {
|
|
||||||
git describe --tags --long | cut -c 2- | sed -e 's/-/./g'
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
install -Dm755 "${srcdir}/proxyenv" "${pkgdir}/usr/bin/proxyenv"
|
|
||||||
install -Dm644 "${srcdir}/proxyenv.conf" "${pkgdir}/etc/proxyenv.conf"
|
|
||||||
install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/proxyenv/LICENSE"
|
|
||||||
}
|
|
48
README.md
48
README.md
|
@ -1,48 +0,0 @@
|
||||||
# proxyenv
|
|
||||||
|
|
||||||
This program is designed to be used like proxychains, that is
|
|
||||||
|
|
||||||
`proxyenv <any program> <any arguments for the program>`
|
|
||||||
|
|
||||||
This program used to be a simple bash function, firsted introduced
|
|
||||||
at [A shell function to set environemt for any single command (Title has been translated)](https://blog.leafee98.com/posts/%E4%B8%BA%E5%8D%95%E4%B8%80%E5%91%BD%E4%BB%A4%E8%AE%BE%E7%BD%AE%E4%BB%A3%E7%90%86%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E7%9A%84%E7%BB%88%E7%AB%AF%E5%87%BD%E6%95%B0/).
|
|
||||||
|
|
||||||
It works most of the time, but when using other command wrappers like `sudo proxyenv cmd`,
|
|
||||||
the shell function will not work anymore, because in the context of sudo, the function
|
|
||||||
proxyenv is inaccessible.
|
|
||||||
|
|
||||||
So I make it as an bash script, which still accessible inside any other program wrappers,
|
|
||||||
that's this program.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```
|
|
||||||
proxyenv <any program> <any arguments>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
If environemt `PROXYENV_CONFPATH` is set, the program will use the path indicted by it to
|
|
||||||
read the proxy actually to be used. Otherwise `/etc/proxyenv.conf` will be used.
|
|
||||||
|
|
||||||
The configuration file (default `/etc/proxyenv.conf`) will be sourced when proxyenv run,
|
|
||||||
so take care no let this file's permission to open, 755 is suggested.
|
|
||||||
|
|
||||||
For entry detail of configuration file, see `proxyenv.conf` in this repository.
|
|
||||||
|
|
||||||
## Misc
|
|
||||||
|
|
||||||
### Which version to use
|
|
||||||
|
|
||||||
Althought there are tags, using the code on branch `main` is always suggested. The tag
|
|
||||||
was added just to let `git describe` happy, which used in `PKGBUILD`
|
|
||||||
|
|
||||||
### Install on Archlinux
|
|
||||||
|
|
||||||
Since I add a PKGBUILD at the root of repository, you can use the following command
|
|
||||||
to build and install this program on Archlinux.
|
|
||||||
|
|
||||||
```
|
|
||||||
makepkg
|
|
||||||
pacman -U <generated package>
|
|
||||||
```
|
|
11
proxyenv
11
proxyenv
|
@ -1,16 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Just quit queitly when no program specfied
|
|
||||||
if (( "$#" == 0 )) ; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$PROXYENV_CONFPATH" ]] ; then
|
if [[ -z "$PROXYENV_CONFPATH" ]] ; then
|
||||||
if [[ -e "/etc/proxyenv.conf" ]] ; then
|
if [[ -e "/etc/proxyenv.conf" ]] ; then
|
||||||
source "/etc/proxyenv.conf"
|
source "/etc/proxyenv.conf"
|
||||||
else
|
else
|
||||||
echo "custom configuration location '/etc/proxyenv.conf' not exists" >&2
|
echo "custom configuration location '/etc/proxyenv.conf' not exists" >&2
|
||||||
echo "exiting..."
|
echo "exiting...'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -18,14 +13,14 @@ else
|
||||||
source "$PROXYENV_CONFPATH"
|
source "$PROXYENV_CONFPATH"
|
||||||
else
|
else
|
||||||
echo "custom configuration location '$PROXYENV_CONFPATH' not exists" >&2
|
echo "custom configuration location '$PROXYENV_CONFPATH' not exists" >&2
|
||||||
echo "exiting..."
|
echo "exiting...'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$PROXYENV_TARGET_PROXY" ]] ; then
|
if [[ -z "$PROXYENV_TARGET_PROXY" ]] ; then
|
||||||
echo "cannot find PROXYENV_TARGET_PROXY" >&2
|
echo "cannot find PROXYENV_TARGET_PROXY" >&2
|
||||||
echo "exiting..."
|
echo "exiting...'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue