-
Notifications
You must be signed in to change notification settings - Fork 0
0.6 #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
0.6 #7
Changes from all commits
41105fe
acf87d1
5a6366a
1a1f493
4ab4f2d
cf68b0d
89c2dea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,35 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
| set -x | ||
|
|
||
| # Set execution permissions for all files in /bin/shutils/ | ||
| chmod -R +x /bin/shutils/ | ||
| SHUTILS_FILE="/bin/shutils/shutils.sh" | ||
| PROFILE_FILE="/etc/profile.d/shutils.sh" | ||
| BASHRC_FILE="/etc/bash.bashrc" | ||
| ZSHRC_FILE="/etc/zsh/zshrc" | ||
| HOOK_LINE='. /etc/profile.d/shutils.sh' | ||
|
|
||
| # Check if the shutils.sh file exists | ||
| if [ -f /bin/shutils/shutils.sh ]; then | ||
| . /bin/shutils/shutils.sh | ||
| else | ||
| echo "Error: can't find /bin/shutils/shutils.sh file" | ||
| if [ ! -f "$SHUTILS_FILE" ]; then | ||
| echo "Error: can't find $SHUTILS_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Export functions to bash and zsh | ||
| echo '. /bin/shutils/shutils.sh' > /etc/profile.d/shutils.sh | ||
| cat > "$PROFILE_FILE" <<EOF | ||
| [ -f "$SHUTILS_FILE" ] && . "$SHUTILS_FILE" | ||
| EOF | ||
|
|
||
| chmod 644 "$PROFILE_FILE" | ||
|
|
||
| # Add shutils to bashrc and zshrc if not already present | ||
| if [ -f /etc/bash.bashrc ]; then | ||
| if ! grep -q '/etc/profile.d/shutils.sh' /etc/bash.bashrc; then | ||
| echo ". /etc/profile.d/shutils.sh" >> /etc/bash.bashrc | ||
| if [ -f "$BASHRC_FILE" ]; then | ||
| if ! grep -Fqx "$HOOK_LINE" "$BASHRC_FILE"; then | ||
| echo "$HOOK_LINE" >> "$BASHRC_FILE" | ||
| fi | ||
| fi | ||
| if [ -f /etc/zsh/zshrc ]; then | ||
| if ! grep -q '/etc/profile.d/shutils.sh' /etc/zsh/zshrc; then | ||
| echo ". /etc/profile.d/shutils.sh" >> /etc/zsh/zshrc | ||
|
|
||
| if [ -f "$ZSHRC_FILE" ]; then | ||
| if ! grep -Fqx "$HOOK_LINE" "$ZSHRC_FILE"; then | ||
| echo "$HOOK_LINE" >> "$ZSHRC_FILE" | ||
| fi | ||
| fi | ||
|
|
||
| echo "Shutils installation completed." | ||
| exit 0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,5 @@ | ||
| #!/bin/bash | ||
| set -e | ||
| set -x | ||
|
|
||
| echo "Looking for old version of shutils..." | ||
|
|
||
| if [ -f /etc/profile.d/shutils.sh ]; then | ||
| sudo rm -f /etc/profile.d/shutils.sh | ||
| echo "Removed old shutils from /etc/profile.d..." | ||
| fi | ||
|
|
||
| if [ -d /bin/shutils ]; then | ||
| sudo rm -rf /bin/shutils | ||
| echo "Removed old shutils from /bin..." | ||
| fi | ||
|
|
||
| # Clean up shutils entries from bashrc | ||
| if [ -f /etc/bash.bashrc ]; then | ||
| sed -i '/\. \/etc\/profile\.d\/shutils\.sh/d' /etc/bash.bashrc | ||
| fi | ||
|
|
||
| # Check if zshrc exists before trying to modify it | ||
| if [ -f /etc/zsh/zshrc ]; then | ||
| sed -i '/\. \/etc\/profile\.d\/shutils\.sh/d' /etc/zsh/zshrc | ||
| fi | ||
| exit 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/bin/bash | ||
| set -e | ||
| set -x | ||
|
|
||
| BASHRC_FILE="/etc/bash.bashrc" | ||
| ZSHRC_FILE="/etc/zsh/zshrc" | ||
| PROFILE_FILE="/etc/profile.d/shutils.sh" | ||
|
|
||
| case "$1" in | ||
| remove|deconfigure) | ||
| sed -i '\|^\. /etc/profile\.d/shutils\.sh$|d' "$BASHRC_FILE" || true | ||
| sed -i '\|^\. /etc/profile\.d/shutils\.sh$|d' "$ZSHRC_FILE" || true | ||
| rm -f "$PROFILE_FILE" || true | ||
| ;; | ||
| esac | ||
|
|
||
| exit 0 |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The installation path
/bin/shutilsis non-standard according to the Filesystem Hierarchy Standard (FHS), which discourages creating subdirectories within/bin. A more compliant location for package-specific executables and support files would be/usr/lib/shutils. This change would also require updating the path indev/prerm,dev/postrm, and thedebian/installfile.Additionally,
HOOK_LINEis hardcoded and could be defined using thePROFILE_FILEvariable for better maintainability.