Skip to content
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

Add installation script #9

Closed
5 of 7 tasks
andresgongora opened this issue Apr 23, 2019 · 7 comments
Closed
5 of 7 tasks

Add installation script #9

andresgongora opened this issue Apr 23, 2019 · 7 comments
Assignees
Milestone

Comments

@andresgongora
Copy link
Owner

andresgongora commented Apr 23, 2019

Add installation scripts that take care of copying everything into place, and if possible, an AUR script, for:

  • Better bash promt
  • System-status terminal greeter
  • Prevent multiple additions of the anchor in /etc/bash.bash.rc
  • Automatic installation and manual installation
  • Uninstall
  • Update instructions for installer
  • Update instructions for user-specific config
@andresgongora
Copy link
Owner Author

andresgongora commented May 25, 2019

The script should take care of everything but downloading the repo. That should be handled by the AUR package or the user. There should basically be an install.sh that does everything for the user. THe following function are desirable:

  • If the user has root privileges, put it somewhere on the system
  • If the user has no root privileges, ask where to put the scripts. Use the current pwd as default
  • Copy the example config files to ~/.config/scripts

@andresgongora andresgongora changed the title Add instalation script for some scripts Add installation script May 25, 2019
@andresgongora andresgongora added this to the Installer milestone May 25, 2019
@andresgongora
Copy link
Owner Author

Some dirty notes

If installed by AUR or DEB:
/usr/bin is for distribution-managed normal user programs.

If installed manually:
/usr/local/bin is for normal user programs not managed by the distribution package manager, e.g. locally compiled packages. You should not install them into /usr/bin because future distribution upgrades may modify or delete them without warning.

teh path of where to install it shoudl be an external script parameter, set by default to /usr/local/bin, but which might be overriden by AUR or DEB.
The installer should also check whether the script already exists in any other folder (/usr/local/bin or /usr/bin) regardless of how it is installed, and remove it.

To apply to all bashrc: /etc/bash.bashrc
But add several and reduntant checks to see if scripts are in place and so on
Also, DO NOT apply to root account
When modifying /etc/bash.bashrc, make sure there is not an entry for the scripts already in place. Ideally, do not add everything, but source a script that takes care of all.
That way, only 1 line is added to /etc/bash.bashrc and its easier to check and modify in the future

@andresgongora
Copy link
Owner Author

@olmari Can you test the script? The instructions are on the README.md file

@andresgongora
Copy link
Owner Author

Working on this to remove recursivity

@andresgongora
Copy link
Owner Author

by @olmari, extracted from his own bash.basrc: method to handle problems with the script

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
	function command_not_found_handle {
	        # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
		   /usr/lib/command-not-found -- "$1"
                   return $?
                elif [ -x /usr/share/command-not-found/command-not-found ]; then
		   /usr/share/command-not-found/command-not-found -- "$1"
                   return $?
		else
		   printf "%s: command not found\n" "$1" >&2
		   return 127
		fi
	}
fi

@andresgongora
Copy link
Owner Author

Added working installer and updated README to features/installer.

@andresgongora
Copy link
Owner Author

Installation works great. See latest push to branch features/installer.
But, I still have the following problem:

  • I'm unable to control when the hook is appended to /etc/bash.bashrc. Ideally, it should check if the hook is already present in the file (something like a multi-line grep) and only append it if not

  • Likewise, for the uninstaller, I really need to check if the hook is in /etc/bash.bashrc, and if so, delete it. Otherwise, the script will leave residues in the system.

In both cases, the hook is stored in the variable hook. The script should do the automatic append/removal using the content of said variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant