Welcome to kriss.run!


Back

sf02-profile.sh

#!/usr/bin/env bash

__profile() {

    # ======================================================================= #
    #                                 VARIABLES                               #
    # ======================================================================= #


    # ======================================================================= #
    #                                   ENV                                   #
    # ======================================================================= #
    if [ -z "$SF_ENV_SOURCED" ]; then
        echo "The /etc/profile.d/sf01-profile-env.sh file does not exist. Please create it."
        return 1
    fi

    # ======================================================================= #
    #                                 LINKS                                   #
    # ======================================================================= #
    if [ ! -h "$HOME/scripts" ]; then
        ln -sf "$SCRIPTS_DIR" "$HOME/scripts"
    fi

    if [ ! -h "$HOME/bin" ]; then
        ln -sf "$BIN_DIR" "$HOME/bin"
    fi

    # ======================================================================= #
    #                                 ALIASES                                 #
    # ======================================================================= #
    export LS_OPTIONS='--color=auto'
    alias cls='clear'
    alias ls='ls $LS_OPTIONS'
    alias ll='ls -lah $LS_OPTIONS'
    alias la='ls -lah $LS_OPTIONS'
    alias l='ls -lah $LS_OPTIONS'

    # ======================================================================= #
    #                           cht.sh (cheat sheet)                          #
    # ======================================================================= #
    cht() {
        if [ -z "$1" ]; then
            echo "Usage: cht <query>"
            return 1
        fi

        curl -s "https://cht.sh/$1"
    }

    # ======================================================================= #
    #                                SSH Agent                                #
    # ======================================================================= #
    eval "$(ssh-agent -s)" > /dev/null
    ssh-add ~/.ssh/Darknetzz > /dev/null

    # ======================================================================= #
    #                                 TEMPLATE                                #
    # ======================================================================= #
    # Check if the .template file exists
    if [ -f "$SCRIPTS_DIR/.template" ]; then
        echo "This is a template server. To deploy it, run the following command:"
        echo "deploy deploy"
    fi

    # Check if the .deploy file exists
    if [ -f "$SCRIPTS_DIR/.deploy" ]; then
        echo "DEPLOYED!"
        echo "Server $HOSTNAME has been deployed. This message will only show once."
        echo "To convert it back to a template server, run the following command:"
        echo "deploy template"
        rm -f "$SCRIPTS_DIR/.deploy"
    fi

    # Print deployment information
    if [ -f "$BIN_DIR/deployment_info" ]; then
        source "$BIN_DIR/deployment_info"
    fi

}

__profile