Tidying up
This commit is contained in:
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash
|
||||
|
||||
# A convenience script that will download the ZX installer, unpack it, and clean up.
|
||||
# For maximum portability this script uses the gzipped package version.
|
||||
|
||||
version=0.9.1
|
||||
zx="zx-$version"
|
||||
tarball="$zx.tar.gz"
|
||||
|
||||
wget -nv "https://zxq9.com/projects/zomp/$tarball"
|
||||
tar -zxf "$tarball"
|
||||
cd "$zx"
|
||||
chmod +x install
|
||||
./install
|
||||
cd ..
|
||||
rm -rf "$zx"
|
||||
rm "$tarball"
|
||||
rm -- "$0"
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
#! /bin/bash
|
||||
|
||||
zomp_dir="$HOME"/zomp
|
||||
bin="$HOME"/bin
|
||||
|
||||
cd "$(dirname $(realpath $0))"
|
||||
chmod +x uninstall
|
||||
|
||||
if erl=$(command -v erl)
|
||||
then
|
||||
echo "Erlang found at $erl"
|
||||
else
|
||||
echo "Could not find an Erlang installation!"
|
||||
echo "Erlang must be installed and available in \$PATH to proceed."
|
||||
exit 95
|
||||
fi
|
||||
|
||||
if [ -d "$zomp_dir" ]
|
||||
then
|
||||
echo "Installation directory $zomp_dir already exists. Aborting."
|
||||
exit 17
|
||||
fi
|
||||
|
||||
if [ ! -d "$bin" ]
|
||||
then
|
||||
echo "$bin does not exist. Creating it."
|
||||
mkdir "$bin"
|
||||
fi
|
||||
|
||||
if [[ ":$PATH:" == *":$bin:"* ]]
|
||||
then
|
||||
echo "$bin was found in \$PATH. Good to go."
|
||||
else
|
||||
echo "$bin was not found in \$PATH. Adding it."
|
||||
export PATH="$bin:$PATH"
|
||||
fi
|
||||
|
||||
for rc in "$HOME/.profile" "$HOME/.bashrc" "$HOME/.bash_profile"
|
||||
do
|
||||
if [ -f "$rc" ]
|
||||
then
|
||||
if grep -q "PATH=\"\$HOME/bin:\$PATH\"" "$rc"
|
||||
then
|
||||
echo "Path adjustment found in $rc."
|
||||
else
|
||||
echo "Path adjustment not found in $rc. Adding it."
|
||||
echo "export PATH=\"\$HOME/bin:\$PATH\"" >> "$rc"
|
||||
fi
|
||||
else
|
||||
echo "No $rc is present. Skipping."
|
||||
fi
|
||||
done
|
||||
|
||||
cp -r zomp "$zomp_dir"
|
||||
cp unix/zx "$zomp_dir"
|
||||
cp unix/zxh "$zomp_dir"
|
||||
cp README.md "$zomp_dir"
|
||||
cp LICENSE "$zomp_dir"
|
||||
cp uninstall "$zomp_dir"
|
||||
ln -s "$zomp_dir"/zx "$bin"/zx
|
||||
ln -s "$zomp_dir"/zxh "$bin"/zxh
|
||||
|
||||
if zx_link=$(command -v zx)
|
||||
then
|
||||
echo "zx found at $zx_link. Checking for upgrade."
|
||||
echo "Running \`zx upgrade\`..."
|
||||
zx upgrade
|
||||
else
|
||||
echo "zx is not yet in \$PATH."
|
||||
echo "Add zx's location ($HOME/bin) to \$PATH run \`zx upgrade\`."
|
||||
fi
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#! /bin/sh
|
||||
|
||||
rm -f "$HOME/bin/zx"
|
||||
rm -f "$HOME/bin/zxh"
|
||||
rm -rf "$HOME/zomp"
|
||||
Reference in New Issue
Block a user