66 lines
2.3 KiB
Bash
Executable File
66 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Simple Note System - Install Script
|
|
# Copyright (C) 2016, Jon Lewis
|
|
#
|
|
# 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.
|
|
|
|
if [ "$1" == "--uninstall" ]; then
|
|
rm /bin/sns
|
|
rm /usr/share/bash-completion/completions/sns
|
|
exit
|
|
fi
|
|
|
|
mkdir build
|
|
|
|
S=build/sns.sh
|
|
|
|
bash header.sh > "$S"
|
|
echo -e "\n# Section: Functions" >> "$S"
|
|
cat ./src/includes/init_store.sns.sh >> "$S"
|
|
cat ./src/includes/verify_store.sns.sh >> "$S"
|
|
cat ./src/includes/help.sns.sh >> "$S"
|
|
cat ./src/includes/p_header.sh >> "$S"
|
|
cat ./src/includes/libencryption.sns.sh >> "$S"
|
|
cat ./src/includes/create.sns.sh >> "$S"
|
|
cat ./src/includes/delete.sns.sh >> "$S"
|
|
cat ./src/includes/edit.sns.sh >> "$S"
|
|
cat ./src/includes/print.sns.sh >> "$S"
|
|
cat ./src/includes/list.sns.sh >> "$S"
|
|
printf "%s\n" "# End Section: Functions" >> "$S"
|
|
cat ./src/main/stage1.sns.sh >> "$S"
|
|
cat ./src/main/stage2.sns.sh >> "$S"
|
|
cat ./src/main/stage3.sns.sh >> "$S"
|
|
|
|
chmod +x "$S"
|
|
# Install SNS
|
|
if [ ! -r "/bin/sns" ]; then
|
|
sudo cp "$S" "/bin/sns"
|
|
else
|
|
if grep "simple note system" "/bin/sns"; then
|
|
sudo rm /bin/sns
|
|
sudo cp "$S" "/bin/sns"
|
|
fi
|
|
fi
|
|
# Install Bash completion
|
|
if [ ! -r "/usr/share/bash-completion/completions/sns" ]; then
|
|
sudo cp "src/bash-completion/sns" "/usr/share/bash-completion/completions/sns"
|
|
else
|
|
if grep "simple note system" "/usr/share/bash-completion/completions/sns"; then
|
|
sudo rm /bin/sns
|
|
sudo cp "$S" "/bin/sns"
|
|
fi
|
|
fi
|
|
exit
|