You can create a shell script to allow users to specify a custom installation directory for Git LFS and provide options for both installing and uninstalling Git LFS. Here's a sample shell script that accomplishes this [1]: ```shell #!/bin/bash # Function to install Git LFS in the specified directory install_git_lfs() { local install_dir="$1" if [ -z "$install_dir" ]; then echo "Usage: $0 install <install_directory>" exit 1 fi # Check if Git LFS is already installed in the specified directory if [ -x "$install_dir/git-lfs" ]; then echo "Git LFS is already installed in $install_dir." exit 1 fi # Download and install Git LFS echo "Installing Git LFS in $install_dir..." mkdir -p "$install_dir" cd "$install_dir" || exit curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash apt-get install git-lfs echo "Git LFS has been installed in $install_dir." } # Function to uninstall Git LFS from the specified directory uninstall_git_lfs() { local install_dir="$1" if [ -z "$install_dir" ]; then echo "Usage: $0 uninstall <install_directory>" exit 1 fi # Check if Git LFS is installed in the specified directory if [ -x "$install_dir/git-lfs" ]; then echo "Uninstalling Git LFS from $install_dir..." cd "$install_dir" || exit git lfs uninstall rm "$install_dir/git-lfs" echo "Git LFS has been uninstalled from $install_dir." else echo "Git LFS is not installed in $install_dir." fi } # Main script if [ "$1" = "install" ]; then install_git_lfs "$2" elif [ "$1" = "uninstall" ]; then uninstall_git_lfs "$2" else echo "Usage: $0 [install|uninstall] <install_directory>" exit 1 fi ``` Save this script to a file (e.g., git-lfs-installer.sh) and make it executable with the following command: ``` chmod +x git-lfs-installer.sh ``` Usage: To install Git LFS to a custom directory: ``` ./git-lfs-installer.sh install /path/to/install/directory ``` To uninstall Git LFS from a custom directory: ``` ./git-lfs-installer.sh uninstall /path/to/install/directory ``` The script uses the curl command to download and install Git LFS from the official GitHub repository. You can customize it further to suit your specific needs or adapt it for different package managers if needed.