This commit is contained in:
anki-code 2020-03-18 10:06:23 +03:00
parent 4ce44761be
commit 1de7bf801e
4 changed files with 3 additions and 46 deletions

View File

@ -4,9 +4,9 @@
3. Rename your repo to `xxh-shell-myshell`
4. Install [xxh](https://github.com/xxh/xxh) and run once to creating `~/.xxh`
5. `cd ~/.xxh/xxh/shells && git clone https://github.com/you/xxh-shell-myshell && cd xxh-shell-myshell`
6. Edit `build.xsh` script. While build you should create `build` directory with minimal group of files to run the portable shell.
6. Edit `build.sh` script. While build you should create `build` directory with minimal group of files to run the portable shell.
7. Edit `entrypoint.sh` script. This script should be copied to `build` directory while building and this script will be the main entrypoint to the shell.
8. Run `./build.xsh`. It will be great if after building you can run `build/entrypoint.sh` and open the shell locally.
8. Run `./build.sh`. It will be great if after building you can run `build/entrypoint.sh` and open the shell locally.
9. Try to connect: `xxh myhost +if +s xxh-shell-myshell` (`+if` means force reinstall).
10. Try to use commands, try to move thru directories. If everything as expected try commit and push your changes.
11. You rock! [Tell us about your work](https://gitter.im/xonssh-xxh/community)!

1
build.sh Executable file
View File

@ -0,0 +1 @@
#!/usr/bin/env bash

View File

@ -1,43 +0,0 @@
#!/usr/bin/env xonsh
#
# Build script is needed to create `build` directory with all files needed to run portable shell on the host
#
import sys, argparse
from shutil import which
parser = argparse.ArgumentParser(description='build')
parser.add_argument('-q', '--quiet', action='store_true', help=f"Quiet mode")
opt = parser.parse_args()
def eprint(*args, **kwargs):
if not opt.quiet:
print(*args, file=sys.stderr, **kwargs)
script_dir = pf"{__file__}".absolute().parent
build_dir = script_dir / 'build'
rm -rf @(build_dir)/
mkdir -p @(build_dir)
cp @(script_dir / 'entrypoint.sh') @(build_dir)/
cd @(build_dir)
if p'your_portable_shell'.exists():
eprint('SKIP: Portable shell already builded')
else:
shell_url='...'
eprint(f'Download <your_portable_shell> from {shell_url}')
arg_q = ['-q'] if opt.quiet else []
arg_s = ['-s'] if opt.quiet else []
arg_progress = [] if opt.quiet else ['--show-progress']
if which('wget'):
r =![wget @(arg_q) @(arg_progress) @(shell_url) -O your_portable_shell]
if r.returncode != 0:
eprint(f'Error while download using wget: {r}')
exit(1)
elif which('curl'):
r =![curl @(arg_s) -L @(shell_url) -o your_portable_shell]
if r.returncode != 0:
eprint(f'Error while download using curl: {r}')
exit(1)

View File

@ -1,2 +1 @@
xxh-xxh
xonsh