CoolFace
Apppublic

gvatsal60/github-test

sourceHugging Faceapache-2.0updated 18h agoView on Hugging Face
0likes
postCreateScript.sh76 linesDownload Raw Back to .devcontainer
1#!/bin/sh2 3##########################################################################################4# File: postCreateScript.sh5# Author: Vatsal Gupta6# Description:7 8# This script runs automatically after the DevContainer environment has been created.9# It performs various initialization tasks to ensure the development environment is properly configured.10 11# 1. Install necessary dependencies:12#    Installs any required software packages, libraries, or tools that are not included in the base container image.13# 2. Set up environment variables:14#    Configures environment variables needed for the project or development workflow.15# 3. Configure services:16#    Sets up or configures additional services or daemons required by the project.17# 4. Perform custom setup tasks:18#    Includes tasks such as generating configuration files, setting up initial data, or performing cleanup.19 20# Ensure that the development environment is consistently set up with the necessary tools and settings for a smooth workflow.21##########################################################################################22##########################################################################################23# License24##########################################################################################25# This script is licensed under the Apache 2.0 License.26# License information should be updated as necessary.27 28##########################################################################################29# Constants30##########################################################################################31readonly SNIPPETS_DIR="snippets"32readonly VSCODE_DIR=".vscode"33readonly SNIPPET_FILES_PATTERN="*.code-snippets"34 35readonly ALIAS_SRC_URL="https://raw.githubusercontent.com/gvatsal60/Linux-Aliases/HEAD/install.sh"36readonly UV_INSTALL_URL="https://astral.sh/uv/install.sh"37 38##########################################################################################39# Functions40##########################################################################################41curl_https() {42    if ! command -v curl >/dev/null 2>&1; then43        echo "Error: curl is not installed. Aborting." >&244        return 145    fi46    curl -fsSL --proto '=https' "$@"47}48 49##########################################################################################50# Main Script51##########################################################################################52 53# Install Linux aliases from external script using curl and execute immediately54# Note: Make sure to review scripts fetched from external sources for security reasons55curl_https "${ALIAS_SRC_URL}" | sh56curl_https "${UV_INSTALL_URL}" | sh57 58# As bind mounts not supported in GitHub Codespaces59if [ -n "${CODESPACE_NAME}" ]; then60    # Generate symlinks for snippet files61    # Create the .vscode directory if it doesn't already exist.62    mkdir -p "${VSCODE_DIR}"63    # Unlink all symbolic links in the '.vscode' directory64    find "${VSCODE_DIR}" -type l -name "${SNIPPET_FILES_PATTERN}" | while read -r file; do65        unlink "${file}"66    done67    # Check if the 'snippets' directory exists68    if [ -d "${SNIPPETS_DIR}" ]; then69        # Find all .code-snippet files in the 'snippets' directory and create symbolic links70        find "${SNIPPETS_DIR}" -type f -name "${SNIPPET_FILES_PATTERN}" | while read -r file; do71            # Create a symbolic link in '.vscode' with the same base name72            ln -s "$(realpath "${file}")" "${VSCODE_DIR}/$(basename "${file}")"73        done74    fi75fi76