tildemerge/install.sh

49 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# Copyright (c) 2018-2019 TildeLinux Maintainers
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Email: tildelinux@tildeverse.org
if test -z "$1"
then
install_dir="$HOME/.local/bin"
else
install_dir="$1"
fi
install_scripts() {
for f in *.sh
do
if ! printf "%s" "$f" | grep -q "install.sh"
then
full_path="${install_dir}/${f}"
cp "$f" "$install_dir"
printf "Copied %s to %s.\\n" "$f" "$full_path"
chmod +x "$full_path"
printf "Made %s executable.\\n\\n" "$full_path"
fi
done
}
if test -f "$install_dir"
then
install_scripts
else
printf "%s not found, creating...\\n" "$install_dir"
mkdir -p "$install_dir"
install_scripts
fi