22 Commits

Author SHA1 Message Date
Phani Pavan K
0d0b3477cd lowercase usernames
All checks were successful
/ Lint Check Shellscripts (push) Successful in 16s
/ Lint Check Shellscripts (pull_request) Successful in 12s
2026-01-13 20:32:34 +05:30
Phani Pavan K
e1f056a294 run only as root, remove read loop, add double question for deluser
All checks were successful
/ Lint Check Shellscripts (push) Successful in 28s
/ Lint Check Shellscripts (pull_request) Successful in 11s
2026-01-13 19:32:19 +05:30
e4f761b133 lint fixed
All checks were successful
/ Lint Check Shellscripts (push) Successful in 12s
/ Lint Check Shellscripts (pull_request) Successful in 11s
2026-01-12 09:20:20 +05:30
aa297095b0 lint error corrected
Some checks failed
/ Lint Check Shellscripts (push) Failing after 16s
/ Lint Check Shellscripts (pull_request) Failing after 11s
2026-01-12 09:19:32 +05:30
104a59c52c Merge branch 'master' into jbomb-automate
Some checks failed
/ Lint Check Shellscripts (push) Failing after 11s
/ Lint Check Shellscripts (pull_request) Failing after 11s
2026-01-11 10:15:06 +00:00
a3ccb1f3b4 lint scripts
All checks were successful
/ Lint Check Shellscripts (push) Successful in 31s
2026-01-11 10:24:20 +05:30
29adac2e70 Merge branch 'master' into jbomb-automate
Some checks failed
/ Lint Check Shellscripts (push) Failing after 11s
/ Lint Check Shellscripts (pull_request) Failing after 11s
2026-01-06 11:33:00 +00:00
9c56e9b87a Update .gitea/workflows/lint.yaml
Some checks failed
/ Lint Check Shellscripts (push) Failing after 12s
2026-01-06 11:32:23 +00:00
f01555b0e5 Update .gitea/workflows/lint.yaml
Some checks failed
/ Lint Check Shellscripts (push) Failing after 10s
2026-01-06 11:31:15 +00:00
2bf64689db Update .gitea/workflows/lint.yaml
Some checks failed
/ Lint Check Shellscripts (push) Failing after 10s
2026-01-06 11:30:35 +00:00
e66abe2467 Update .gitea/workflows/lint.yaml
Some checks failed
/ Lint Check Shellscripts (push) Failing after 13s
2026-01-06 11:28:41 +00:00
364d967b8f Update .gitea/workflows/lint.yaml 2026-01-06 11:28:10 +00:00
46bfeaa6fe Update .gitea/workflows/lint.yaml
Some checks failed
/ Lint Check Shellscripts (push) Failing after 14s
2026-01-06 11:24:50 +00:00
9e3a36aa0e user management commands automated
Some checks failed
/ Lint Check Shellscripts (push) Failing after 32s
/ Lint Check Shellscripts (pull_request) Failing after 12s
2026-01-06 11:20:33 +00:00
3ea86d7e35 user management commands automated 2026-01-06 11:20:33 +00:00
a1e8a03f60 user management commands automated 2026-01-06 11:20:33 +00:00
ee39307fac Update .NOAI
Some checks failed
/ Lint Check Shellscripts (push) Failing after 48s
2026-01-04 06:31:42 +00:00
00824af5b2 Update .NOAI 2026-01-04 06:28:01 +00:00
6d1f59e50d Update .gitea/workflows/lint.yaml 2026-01-04 06:26:00 +00:00
cb10a22c3d Add .gitea/workflows/lint.yaml 2026-01-04 06:25:15 +00:00
64e15bc2a9 Merge pull request 'year refresh' (#3) from test into master
Reviewed-on: #3
2026-01-02 16:30:38 +00:00
7b1d8d76b0 year refresh (#3)
Reviewed-on: #3
2026-01-02 16:30:04 +00:00
3 changed files with 103 additions and 29 deletions

View File

@@ -0,0 +1,18 @@
on: [push, pull_request]
jobs:
CI:
name: Lint Check Shellscripts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Linter
run: |
wget -qO- 'https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.linux.aarch64.tar.xz' | tar -xJv
cp 'shellcheck-v0.11.0/shellcheck' /usr/local/bin
rm -rf "shellcheck-v0.11.0"
shellcheck --version
- name: Run Linter
run: |
shellcheck --exclude=SC1090,SC2046 penv
shellcheck --exclude=SC1090,SC2046 jconf

64
jconf Normal file → Executable file
View File

@@ -39,16 +39,72 @@ if [ "$#" -lt 1 ]; then
exit 1
fi
if [[ "$EUID" -ne 0 ]]; then
echo "Run the script as root"
exit 2
fi
cmd=$1
case "$cmd" in
adduser)
echo
USER=$(echo "$2" | tr "[:upper:]" "[:lower:]")
exist=$(awk -F: -v username="$USER" '{if ($1 == username && $3 >= 1000 && $1 != "nobody") {print 1; found=1; exit}} END {if (!found) print 0}' /etc/passwd)
if [ "$exist" -eq 1 ]; then
echo "$USER user already exists"
else
read -rp "Do you want to create an user account $USER [y/N]:" yn
case $yn in
[Yy])
useradd "$USER"
echo "Enter the password for $USER"
passwd "$USER"
echo "$USER user account created successfully"
;;
[Nn])
exit 1
;;
* )
echo "Please answer Y or N."
;;
esac
fi
exit 1
;;
deluser)
echo
USER=$(echo "$2" | tr "[:upper:]" "[:lower:]")
exist=$(awk -F: -v username="$USER" '{if ($1 == username && $3 >= 1000 && $1 != "nobody") {print 1; found=1; exit}} END {if (!found) print 0}' /etc/passwd)
if [ "$exist" -eq 0 ]; then
echo "$USER user doesn't exist"
exit 1
else
read -rp "Do you want to delete $USER user account? [y/N]:" yn
case $yn in
[Yy])
;;
*)
exit 1
;;
esac
read -rp "This DELETES $USER's data, are you sure? [y/N]:" yn
case $yn in
[Yy])
userdel -rRZ "$USER";
echo "$USER user account deleted successfully"
;;
[Nn])
exit 1
;;
* )
echo "Please answer Y or N."
;;
esac
fi
exit 1
;;
listusers)
echo
listusers|ls)
husers=$(awk -F: '{ if ($3 >= 1000 && $1 != "nobody" ) {print $1}}' /etc/passwd)
echo "$husers"
;;
start)
echo

50
penv
View File

@@ -43,7 +43,7 @@ create(){
exit 2
fi
if [[ -d "$HOME/.envs/$name" ]]; then
echo Environment \"$name\" already exists.
echo Environment \""$name"\" already exists.
exit 4
fi
@@ -52,18 +52,18 @@ create(){
echo "Base python3 not found on your system. Install it using your package manager"
exit 3
fi
vers=`/usr/bin/python3 -V | cut -d " " -f 2 | cut -d "." -f 1,2`
vers=$(/usr/bin/python3 -V | cut -d " " -f 2 | cut -d "." -f 1,2)
echo "No version mentioned, using Python $vers"
fi
if [ ! -f /usr/bin/python$vers ]; then
if [ ! -f /usr/bin/python"$vers" ]; then
echo "Python $vers not installed on system."
exit 7
fi
mkdir -p $HOME/.envs
/usr/bin/python$vers -m venv $HOME/.envs/$name
source $HOME/.envs/$name/bin/activate
mkdir -p "$HOME"/.envs
/usr/bin/python"$vers" -m venv "$HOME"/.envs/"$name"
source "$HOME"/.envs/"$name"/bin/activate
python -m pip install ipykernel ipywidgets > /dev/stderr
python -m ipykernel install --user --name $name > /dev/stderr
python -m ipykernel install --user --name "$name" > /dev/stderr
echo
echo "Created \"$name\". It should be available as a Jupyter Kernel."
echo "Use \"pact $name\" to activate in command line."
@@ -81,12 +81,12 @@ delete(){
echo "Run \"deactivate\" to deactivate it"
exit 6
fi
read -n 1 -p "Remove environment $name (y/N)? " choise
read -r -n 1 -p "Remove environment $name (y/N)? " choise
case $choise in
[yY])
source $HOME/.envs/$name/bin/activate
source "$HOME"/.envs/"$name"/bin/activate
echo
echo Spec `jupyter-kernelspec remove -f -y $name`
echo Spec $(jupyter-kernelspec remove -f -y "$name")
deactivate
rm -r "$HOME/.envs/$name"
echo "Data Removed $HOME/.envs/$name"
@@ -114,7 +114,7 @@ delete(){
# }
activate() {
echo Use \"pact $1\"
echo Use \"pact "$1"\"
}
list(){
@@ -122,7 +122,7 @@ list(){
echo "PENV not initialized. Run \"penv init\""
exit 8
fi
ls $HOME/.envs
ls "$HOME"/.envs
}
install() {
@@ -130,8 +130,8 @@ install() {
echo PENV already installed
exit 10
fi
cp $(realpath "$0") $HOME/.local/bin/
mkdir -p $HOME/.envs/
cp $(realpath "$0") "$HOME"/.local/bin/
mkdir -p "$HOME"/.envs/
echo "
pact () {
if [[ -z \"\$1\" ]]; then
@@ -144,17 +144,17 @@ install() {
fi
. \$HOME/.envs/\$1/bin/activate
}
" > $HOME/.envs/.penv.funcs
grep -qxF "source \$HOME/.envs/.penv.funcs" $HOME/.bashrc || echo "source \$HOME/.envs/.penv.funcs" >> $HOME/.bashrc
" > "$HOME"/.envs/.penv.funcs
grep -qxF "source \$HOME/.envs/.penv.funcs" "$HOME"/.bashrc || echo "source \$HOME/.envs/.penv.funcs" >> "$HOME"/.bashrc
echo "Initialized PENV. Restart the shell"
}
uninstall() {
if [[ ! -z "$VIRTUAL_ENV" ]]; then
if [[ -n "$VIRTUAL_ENV" ]]; then
echo "Deactivate the existing environment before uninstalling"
exit 11
fi
read -n 1 -p "REALLY UNINSTALL ALL THE ENVIRONMENTS?(y/N) " ans
read -r -n 1 -p "REALLY UNINSTALL ALL THE ENVIRONMENTS?(y/N) " ans
case $ans in
[yY])
echo
@@ -170,9 +170,9 @@ uninstall() {
return;
;;
esac
sed -i "/source \$HOME\/.envs\/.penv.funcs/d" $HOME/.bashrc
rm -r $HOME/.envs
rm $HOME/.local/bin/penv
sed -i "/source \$HOME\/.envs\/.penv.funcs/d" "$HOME"/.bashrc
rm -r "$HOME"/.envs
rm "$HOME"/.local/bin/penv
echo "Uninstalled PENV"
}
@@ -186,16 +186,16 @@ cmd=$1
case "$cmd" in
new|mk)
create $2 $3
create "$2" "$3"
;;
del|rm)
delete $2
delete "$2"
;;
# setdef|sd)
# setdef $2
# ;;
act|ac)
activate $2
activate "$2"
;;
list|ls)
list
@@ -212,7 +212,7 @@ case "$cmd" in
;;
*)
echo "invalid command: \"$1\"" >&2
echo $SCRIPT
echo "$SCRIPT"
usage
;;
esac