Compare commits
7 Commits
43350eaa41
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 601cd2c7cd | |||
| 1566bc3a05 | |||
|
|
46f327436f | ||
|
|
a9f3b3ac37 | ||
|
|
2d42297d00 | ||
|
|
fb0257d60f | ||
|
|
a64bd7c8a6 |
@@ -8,7 +8,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Linter
|
- name: Install Linter
|
||||||
run: |
|
run: |
|
||||||
wget -qO- 'https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.linux.aarch64.tar.xz' | tar -xJv
|
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.linux.$(uname -m).tar.xz" | tar -xJv
|
||||||
cp 'shellcheck-v0.11.0/shellcheck' /usr/local/bin
|
cp 'shellcheck-v0.11.0/shellcheck' /usr/local/bin
|
||||||
rm -rf "shellcheck-v0.11.0"
|
rm -rf "shellcheck-v0.11.0"
|
||||||
shellcheck --version
|
shellcheck --version
|
||||||
|
|||||||
4
jconf
4
jconf
@@ -11,6 +11,10 @@
|
|||||||
# deluser: deletes jupyterhub user, deletes user home, deletes user profile from system.
|
# deluser: deletes jupyterhub user, deletes user home, deletes user profile from system.
|
||||||
# start: starts the server, systemd call
|
# start: starts the server, systemd call
|
||||||
# stop: stops the server, systemd call
|
# stop: stops the server, systemd call
|
||||||
|
# reference: https://medium.com/@prateekaverma/install-jupyterhub-and-jupyterlab-on-ubuntu-server-d390570b5bb6
|
||||||
|
# detect if jconf is already installed, print who the admin is if so.
|
||||||
|
|
||||||
|
VERSION=1
|
||||||
|
|
||||||
title() {
|
title() {
|
||||||
echo "JConf: JupyterHub Configuration Manager."
|
echo "JConf: JupyterHub Configuration Manager."
|
||||||
|
|||||||
53
penv
53
penv
@@ -5,9 +5,11 @@
|
|||||||
# MIT Licensed, by The Grammer Society
|
# MIT Licensed, by The Grammer Society
|
||||||
|
|
||||||
# Issues:
|
# Issues:
|
||||||
# names are fully lower case when installed as jupyterhub spec. convert name to lower case when deleting an env.
|
|
||||||
# when uninstalling, remove any jupyter specs. iterate through envs in .env, call jspec remove name.
|
# when uninstalling, remove any jupyter specs. iterate through envs in .env, call jspec remove name.
|
||||||
|
|
||||||
|
VERSION=1
|
||||||
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "Usage: penv <command> <args>"
|
echo "Usage: penv <command> <args>"
|
||||||
@@ -21,6 +23,7 @@ usage() {
|
|||||||
echo " - list - List available environments"
|
echo " - list - List available environments"
|
||||||
echo " - pylist - List available PYTHON versions"
|
echo " - pylist - List available PYTHON versions"
|
||||||
echo " - install - Initialize user's profile"
|
echo " - install - Initialize user's profile"
|
||||||
|
echo " - update - Update penv to latest version"
|
||||||
echo " - uninstall - Remove ALL the environments installed using PENV"
|
echo " - uninstall - Remove ALL the environments installed using PENV"
|
||||||
echo " - help - Print this message"
|
echo " - help - Print this message"
|
||||||
echo
|
echo
|
||||||
@@ -31,6 +34,7 @@ usage() {
|
|||||||
echo " - activate -> ac, act"
|
echo " - activate -> ac, act"
|
||||||
echo " - pylist -> pyls"
|
echo " - pylist -> pyls"
|
||||||
echo " - list -> ls"
|
echo " - list -> ls"
|
||||||
|
echo " - update -> up"
|
||||||
}
|
}
|
||||||
|
|
||||||
title(){
|
title(){
|
||||||
@@ -67,6 +71,7 @@ create(){
|
|||||||
python -m pip install ipykernel ipywidgets
|
python -m pip install ipykernel ipywidgets
|
||||||
python -m ipykernel install --user --name "$name"
|
python -m ipykernel install --user --name "$name"
|
||||||
echo
|
echo
|
||||||
|
echo "--------------------------------------------------------------"
|
||||||
echo "Created \"$name\". It should be available as a Jupyter Kernel."
|
echo "Created \"$name\". It should be available as a Jupyter Kernel."
|
||||||
echo "Use \"pact $name\" to activate in command line."
|
echo "Use \"pact $name\" to activate in command line."
|
||||||
deactivate
|
deactivate
|
||||||
@@ -148,12 +153,30 @@ install() {
|
|||||||
return;
|
return;
|
||||||
fi
|
fi
|
||||||
. \$HOME/.envs/\$1/bin/activate
|
. \$HOME/.envs/\$1/bin/activate
|
||||||
|
echo Activated.
|
||||||
|
echo Deactivate using \\\"deactivate\\\" or \\\"pdct\\\"
|
||||||
|
}
|
||||||
|
|
||||||
|
pdct () {
|
||||||
|
if [[ ! -n \"\$VIRTUAL_ENV\" ]]; then
|
||||||
|
echo \"No environment active\"
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
deactivate
|
||||||
}
|
}
|
||||||
" > "$HOME"/.envs/.penv.funcs
|
" > "$HOME"/.envs/.penv.funcs
|
||||||
grep -qxF "source \$HOME/.envs/.penv.funcs" "$HOME"/.bashrc || echo "source \$HOME/.envs/.penv.funcs" >> "$HOME"/.bashrc
|
add2RC bashrc
|
||||||
|
add2RC zshrc
|
||||||
|
chmod +x "$HOME/.local/bin/penv"
|
||||||
echo "Initialized PENV. Restart the shell"
|
echo "Initialized PENV. Restart the shell"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add2RC(){
|
||||||
|
if [[ -f "$HOME/.$1" ]]; then
|
||||||
|
grep -qxF "source \$HOME/.envs/.penv.funcs" "$HOME/.$1" || echo "source \$HOME/.envs/.penv.funcs" >> "$HOME/.$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
uninstall() {
|
uninstall() {
|
||||||
if [[ -n "$VIRTUAL_ENV" ]]; then
|
if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||||
echo "Deactivate the existing environment before uninstalling"
|
echo "Deactivate the existing environment before uninstalling"
|
||||||
@@ -182,9 +205,30 @@ uninstall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pyls(){
|
pyls(){
|
||||||
find /usr/local/bin /usr/bin -name python3.* 2> /dev/null | tr " " "\n" | grep "3.*" --color=always
|
find /usr/local/bin /usr/bin -name "python3.*" 2> /dev/null | tr " " "\n" | grep "3.*" --color=always
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update(){
|
||||||
|
if [[ $(realpath "$0") != "$HOME/.local/bin/penv" ]]; then
|
||||||
|
echo PENV not installed yet. Install it to use the update command.
|
||||||
|
exit 12
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -x "$(command -v curl)" ]; then
|
||||||
|
curl "https://git.pvnweb.dedyn.io/phanipavank/jbomb/raw/branch/master/penv" -o "$HOME/.local/bin/penv"
|
||||||
|
elif [ -x "$(command -v wget)" ]; then
|
||||||
|
wget -o "$HOME/.local/bin/penv" "https://git.pvnweb.dedyn.io/phanipavank/jbomb/raw/branch/master/penv"
|
||||||
|
else
|
||||||
|
echo Curl or wget not found. Install either one to update penv.
|
||||||
|
fi
|
||||||
|
chmod +x "$HOME/.local/bin/penv"
|
||||||
|
sleep 0.5
|
||||||
|
newVer=$(grep VERSION "$HOME/.local/bin/penv" | cut -d '=' -f 2)
|
||||||
|
echo "PENV updated from $VERSION to $newVer"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ "$#" -lt 1 ]; then
|
if [ "$#" -lt 1 ]; then
|
||||||
title
|
title
|
||||||
usage
|
usage
|
||||||
@@ -222,6 +266,9 @@ case "$cmd" in
|
|||||||
uninstall)
|
uninstall)
|
||||||
uninstall
|
uninstall
|
||||||
;;
|
;;
|
||||||
|
update|up)
|
||||||
|
update
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "invalid command: \"$1\"" >&2
|
echo "invalid command: \"$1\"" >&2
|
||||||
echo "$SCRIPT"
|
echo "$SCRIPT"
|
||||||
|
|||||||
Reference in New Issue
Block a user