Skip to content

Commit

Permalink
Start new installer setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Frizlab committed Dec 7, 2020
1 parent 986c90c commit 91a1145
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 247 deletions.
16 changes: 3 additions & 13 deletions conf.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 0 additions & 38 deletions install

This file was deleted.

1 change: 1 addition & 0 deletions install
196 changes: 0 additions & 196 deletions run-ansible

This file was deleted.

Empty file added src/lib/ccrypt.zsh
Empty file.
3 changes: 3 additions & 0 deletions src/lib/logger.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
func hello() {
echo hello
}
60 changes: 60 additions & 0 deletions src/main.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/zsh -euopipefail


################################
# Paths Setup and Verification #
################################

test "$(basename "$0")" = "install" || {
echo "This script must be run from the install alias." >/dev/stderr
exit 1
}
cd "$(dirname "$0")"

# We export PATH in case the variable is not exported yet
export PATH

# We add our own bins to the path, but agree to use the system or user-defined
# ones if they are already there
path+="$(pwd)/.cache/bin"

# Let’s define the different paths we will need
readonly CACHE_FOLDER="$(pwd)/.cache"
readonly SRC_FOLDER="$(pwd)/src"
readonly LIB_FOLDER="$SRC_FOLDER/lib"
readonly COMPONENTS_FOLDER="$SRC_FOLDER/components"

# Create the cache folder if needed
mkdir -p "$CACHE_FOLDER" && chmod 700 "$CACHE_FOLDER"


###############
# Import libs #
###############

source "$LIB_FOLDER/logger.zsh"
source "$LIB_FOLDER/ccrypt.zsh"


# Install ccrypt if needed
command -v ccdecrypt >/dev/null 2>&1 || {
echo "*** Downloading and compiling ccrypt in the .cache folder..."
pushd .cache
readonly CCRYPT_SHASUM="6d20a4db9ef7caeea6ce432f3cffadf10172e420"
readonly CCRYPT_VERSION="1.11"
readonly CCRYPT_BASENAME="ccrypt-$CCRYPT_VERSION"
readonly CCRYPT_TAR_NAME="$CCRYPT_BASENAME.tar.gz"
readonly CCRYPT_URL="http://ccrypt.sourceforge.net/download/$CCRYPT_VERSION/$CCRYPT_TAR_NAME"
test -e "$CCRYPT_TAR_NAME" || curl "$CCRYPT_URL" >"$CCRYPT_TAR_NAME"
test "$(shasum "$CCRYPT_TAR_NAME" | cut -d' ' -f1)" = "$CCRYPT_SHASUM" || {
echo "***** ERROR: ccrypt sha does not match expected sha. Bailing out."
exit 1
}
tar xf "$CCRYPT_TAR_NAME"
pushd "$CCRYPT_BASENAME"
./configure --prefix "$(pwd)/.."
make install
popd
rm -fr "$CCRYPT_BASENAME"
popd
}
1 change: 1 addition & 0 deletions src/vars.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/bin/zsh -e

0 comments on commit 91a1145

Please sign in to comment.