Create subfolders

This commit is contained in:
pberr
2020-10-03 16:39:40 +02:00
parent 68bb954a7f
commit e08001bc54
4 changed files with 2 additions and 2 deletions
Executable
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
if [ "$UID" != "0" ]; then
echo " Only root can execute this script, sorry."
echo " Try 'sudo ./install.sh'"
exit 0
fi
echo ""
echo "======================"
echo " Installing lch"
echo "======================"
echo ""
cp lch /usr/bin/lch
mkdir -p /usr/lib/lch
cp -r ./lib/* /usr/lib/lch
chmod 755 /usr/bin/lch
echo " Copied lch in /usr/bin"
if [ -x "$(command -v man)" ]; then
if [ -z "$MANPATH" ] && [ $(manpath 2> /dev/null) ];then
MANPATH=$(manpath)
else
MANPATH="/usr/local/man"
fi
MANDIR=${MANPATH%%:*}/man1
mkdir -p $MANDIR
cp lch.1 $MANDIR/lch.1
gzip $MANDIR/lch.1
chmod 644 $MANDIR/lch.1.gz
echo " Copied manpage in $MANDIR"
fi
echo ""
echo "============================="
echo " lch installed successfully."
echo "============================="
echo ""
echo " Run 'lch --help' or 'man lch' to see options."
exit 0
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
if [ "$UID" != "0" ]; then
echo " Only root can execute this script, sorry."
echo " Try 'sudo $0'"
exit 0
fi
# Si existe el archivo lch
if [[ -f "/usr/bin/lch" ]]; then
rm /usr/bin/lch
fi
# Si existe el directorio lch
if [[ -d "/usr/lib/lch" ]]; then
rm -rf "/usr/lib/lch"
fi
# Si existe man
if [ -x "$(command -v man)" ]; then
# Si nulo manpath
if [ -z "$MANPATH" ]; then
MANPATH=$(manpath)
fi
MANDIR=${MANPATH%%:*}/man1
# Si man lch.1
if [[ -f "$MANDIR/lch.1" ]]; then
rm "$MANDIR/lch.1"
fi
# Si man lch.1.gz
if [[ -f "$MANDIR/lch.1.gz" ]]; then
rm "$MANDIR/lch.1.gz"
fi
fi
echo "=============================="
echo " lch uninstalled successfully."
echo -e "==============================\n"