d256ff6c67
* fdjfgjdfg * jghkfghkf * fgdfjfghj * sgassg * jksdhgjkasdnh * Adapted code * add vlang * hkghkgh * sdgasdg * sagsdag * gjghfj * hjfghkf * dgsghafh * gjfgjfd * fdhfhfgj * Update gitpod.Dockerfile * fixes * fixes * gjhfhghk * xdgad * dsgasdg * shebang test * sagaga * shash * jfhjgh * hfgdj * dgsdfhsdf * Update gitpod.Dockerfile * dshsfd * hgkgk * ffhdfgj * Update vlang_init.sh * Update vlang_init.sh * agsah * ffgjghjfgh * jghkfg * jghjfh * hdhsfdh * fdhfgj * fdhsfdh * fghdfgh * sdgag * dshas * vcmvmvb * sdagasdg * shfdh * sdagsdag * dfhfgd * Update cargo-make requirement from 0.26.2 to 0.27.0 Updates the requirements on [cargo-make](https://github.com/sagiegurari/cargo-make) to permit the latest version. - [Release notes](https://github.com/sagiegurari/cargo-make/releases) - [Changelog](https://github.com/sagiegurari/cargo-make/blob/master/CHANGELOG.md) - [Commits](https://github.com/sagiegurari/cargo-make/compare/0.26.2...0.27.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * test * Bump termcolor from 1.0.0 to 1.1.0 Bumps [termcolor](http://pypi.python.org/pypi/termcolor) from 1.0.0 to 1.1.0. Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * fdhsfh * Create jekyll.yml * dsadsh * fdhgj * sagsag * sagag * hfgj * sdgsdag * dgasdga * hghkh * sagas * gjkghkf * safsaf * gjfkf * stub * djknsfdjknh * sdgasdg * asasg * safsa * gagsd * IT'S YOUR TURN TRAVIS MUHAHAH * shfdhsfd * gfgj * dfhfgdj * fgkfhg * fdhhsf * fghkjgh * fhdfjh * safsa * sagasga * sdgdsfh * saagsga * gjhlghl * jklhj * gfghkg * gfjdfgj * nm,;n * kljlk'j * jk'jkl' * saasga * sdgasdg * gjghk * dhsfh * fdhsfdj * hkgjkgh * asgsa * fhfgjfg * RUNALISA! * asgas * sasgd * fdfgj * dsfhdsf * fhdfhs * sagasg * sagasg * Fix C and adapt more sanity checks * shdfh * sagsag * safasf * sag * hgjl * asgasg * sgagsa * asfasf * safasf * sasag * fdjfgj * fjdgj * sagasg * Why can't i see the hugging source for this GUI? #ThanksMicrosoft * saksdakhla * jhlgj * hjglh * sdgdasg * saga * safsaf * sagag * fdhsfdh * safasf * fdhjsfdh * PLEASE JUST FUCKING WORK * SAGSAG * sagasg * agaahds * end my suffering * hgkkfkg * all hail twofifths the savior * sagasga * fdhfgh * dgsgh * khgk * asgasg * ddfjhfg * asgagasg * fhdshfd * asasgsagas * hgkg * saasg * saagg * ffdjgf * hlj * vbbghkk * safasf * safsaf * sdhdfh * fdhsdh * saag * sagag * safasf * asgasg * ffgjfg * f54hs6f5d4h * sagasg * dsgasg * sgasdg * gfjfgj * cfghd * fhddfgj * dsgsagd * shsadh * fhdf * fdjhfg * asgasga * sdgag * fjfdgjdf * fdhsfdh * asgsa * sagasg * sagasg * sagasg * dsgsdha * fdhsfhd * YoU cAnT dO tHiS iN ShElL kReY * tetats * gfjdfgj * sagsag * fgj * bvghkf * gfhdfghfg * sdagsadg * sdgasdg * agaas * dassfd * vbghf * jghkgh * hfgdj * gjkjlg * sdgfdg * asgag * fgkgkh * fdhsfdh * dsgasdg * dsgsg * fgj * safsaf * agsgd * Finally we have theia config Relevant: https://github.com/gitpod-io/gitpod/issues/800#issuecomment-587381366 * agsdgh * kjghkgg * vjfgjfgd * add dia * flowchart: init * adgasdg * Update Zernit.drawio * Update Zernit.drawio * Update Zernit.drawio * asdgsdag * fddfhs * saasg * sasag * dgasdgasd * dsgasdg * Create question.md * Update labels.yml * do not bother bug wranglers with questions * sasaasgd * dhfdh * safasf * dsgasdg * Update debian.Dockerfile * dsagasdg * Update debian.Dockerfile * sdghsdf * agasd * Update cargo-make requirement from 0.27.0 to 0.28.0 (#58) Updates the requirements on [cargo-make](https://github.com/sagiegurari/cargo-make) to permit the latest version. - [Release notes](https://github.com/sagiegurari/cargo-make/releases) - [Changelog](https://github.com/sagiegurari/cargo-make/blob/master/CHANGELOG.md) - [Commits](https://github.com/sagiegurari/cargo-make/compare/0.27.0...0.28.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * stub for RXT ownership * Create other.md * Create legal-request.yml * Rename legal-request.yml to legal-request.md * Update bug_report.md * sgsfdh * saga * stub license * Initial configuration Co-authored-by: @Klairm <ivangardis@hotmail.com> - Thanks for C contrib! Co-authored-by: @Uniminin <uniminin@zoho.com> - Thanks for the contribution of annoyance and python! Co-authored-by: @JesterOrNot <seanhellum45@gmail.com> - Thanks for gitpod contrib! https://github.com/RXT0112/Zernit/pull/32 - Thanks for issue-meggage in https://github.com/RXT0112/Zernit/pull/23! Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
159 lines
6.5 KiB
Bash
159 lines
6.5 KiB
Bash
#!/bin/sh
|
|
# Created by Jacob Hrbek <kreyren@rixotstudio.cz> under license GPL-3 (https://www.gnu.org/licenses/gpl-3.0.en.html)
|
|
# Based in part on https://github.com/JesterOrNot/Gitpod-V which is created by Sean Hellum as unlicense
|
|
|
|
: "
|
|
Initialization script made for gitpod to install vlang backend in gitpod
|
|
|
|
This script is developed to be POSIX-compatible
|
|
|
|
Use environment variable '$DEBUG' to output verbose info
|
|
|
|
CONFIGURATION
|
|
- $VLANG_SOURCE = Path used for extraction and keeping of vlang source files
|
|
- $VLANG_VERSION = Expected vlang version (value 'latest' is supported through GitHub API)
|
|
- $VLANG_GROUP = Group used for those that are expected to have access in vlang
|
|
- $CACHEDIR = Path for cache directory, based on FSH3.0 (270120) this should be '$HOME/.cache'
|
|
- $VLANG_EXE = Path to which we will extract executable for vlang
|
|
"
|
|
|
|
# Configuration
|
|
[ -z "$VLANG_SOURCE" ] && VLANG_SOURCE="/opt/vlang"
|
|
[ -z "$VLANG_VERSION" ] && VLANG_VERSION="0.1.24"
|
|
[ -z "$VLANG_GROUP" ] && VLANG_GROUP="vlang"
|
|
[ -z "$CACHEDIR" ] && CACHEDIR="$HOME/.cache"
|
|
[ -z "$VLANG_EXE" ] && VLANG_EXE="/usr/bin/v"
|
|
|
|
# Simplified die for assertion
|
|
die() {
|
|
[ -z "$DIE_PREFIX" ] && DIE_PREFIX="FATAL:"
|
|
printf "$DIE_PREFIX %s\\n" "$2"
|
|
unset VLANG_SOURCE VLANG_VERSION DIE_PREFIX CACHEDIR VLANG_EXE
|
|
exit "$1"
|
|
}
|
|
|
|
edebug() {
|
|
[ -z "$DEBUG_PREFIX" ] && DEBUG_PREFIX="DEBUG:"
|
|
[ -n "$DEBUG" ] && printf "$DEBUG_PREFIX %s\\n" "$1"
|
|
}
|
|
|
|
# checkroot
|
|
if [ "$(id -u)" != "0" ]; then
|
|
die 3 "Insufficient permission UID '$(id -u)' used for vlang initialization"
|
|
elif [ "$(id -u)" = "0" ]; then
|
|
edebug "Script has been executed from expected used with UID '$(id -u)'"
|
|
else
|
|
die 256 "Unexpected happend while checking root"
|
|
fi
|
|
|
|
# Define latest version
|
|
case "$VLANG_VERSION" in
|
|
[0-9].[0-9].[0-9]|[0-9][0-9].[0-9].[0-9]|[0-9][0-9].[0-9][0-9].[0-9]|[0-9][0-9].[0-9][0-9].[0-9][0-9]|[0-9].[0-9][0-9].[0-9]|[0-9].[0-9].[0-9][0-9]) true ;;
|
|
latest)
|
|
VLANG_VERSION="$(curl https://api.github.com/repos/vlang/v/releases/latest 2>/dev/null | grep tag_name | sed '/^[[:blank:]]*"tag_name":[[:blank:]]*"\([^"]*\)",[[:blank:]]*$/!d; s//\1/; q' || die 4 "Unable to get latest vlang version for GitHub API")" ;;
|
|
*) die 2 "Unsupported vlang version '$VLANG_VERSION' has been parsed in vlang_init script"
|
|
esac
|
|
|
|
# Create cachedir
|
|
if [ ! -d "$CACHEDIR" ]; then
|
|
mkdir "$CACHEDIR" || die 1 "Unable to make a new directory in '$HOME/.cache' used for caching"
|
|
edebug "Created a new directory in '$CACHEDIR' used for caching"
|
|
elif [ -d "$CACHEDIR" ]; then
|
|
edebug "Directory '$CACHEDIR' already exits, skipping creation"
|
|
else
|
|
die 256 "Unexpected happend while creating chachedir, bug?"
|
|
fi
|
|
|
|
# Fetch
|
|
if [ ! -f "$CACHEDIR/vlang-$VLANG_VERSION.zip" ]; then
|
|
wget "https://github.com/vlang/v/releases/download/$VLANG_VERSION/v_linux.zip" -O "$CACHEDIR/vlang-$VLANG_VERSION.zip" || die 1 "Unable to fetch vlang tarball"
|
|
edebug "Vlang source tarball has been exported in '$CACHEDIR/vlang-$VLANG_VERSION.zip'"
|
|
elif [ -f "$CACHEDIR/vlang-$VLANG_VERSION.zip" ]; then
|
|
edebug "File '$CACHEDIR/vlang-$VLANG_VERSION.zip' already exists, skipping fetch"
|
|
else
|
|
die 256 "Unexpected happend while fetching vlang source tarball in '$CACHEDIR/vlang-$VLANG_VERSION'"
|
|
fi
|
|
|
|
# Create a new directory used for source files
|
|
if [ ! -d "$VLANG_SOURCE" ]; then
|
|
mkdir "$VLANG_SOURCE" || die 1 "Unable to create a new directory for source extraction of vlang"
|
|
edebug "Created a new directory in '$VLANG_SOURCE' used for vlang source files"
|
|
elif [ -d "$VLANG_SOURCE" ]; then
|
|
edebug "Directory in '$VLANG_SOURCE' is already present, skipping creation"
|
|
else
|
|
die 256 "Unexpected happend while creating a new directory in '$VLANG_SOURCE'"
|
|
fi
|
|
|
|
# Extract
|
|
if [ ! -f "$VLANG_SOURCE/Makefile" ]; then
|
|
unzip "$CACHEDIR/vlang-$VLANG_VERSION.zip" -d "$VLANG_SOURCE" || die 1 "Unable to extract vlang source in '$VLANG_SOURCE' directory"
|
|
edebug "vlang source files has been extracted in '$VLANG_SOURCE'"
|
|
elif [ -f "$VLANG_SOURCE/Makefile" ]; then
|
|
edebug "vlang source files are already extracted, skipping extract"
|
|
else
|
|
die 256 "Unexpected happend while extracting vlang source files"
|
|
fi
|
|
|
|
# Compile
|
|
if [ ! -f "$VLANG_SOURCE/v" ]; then
|
|
make -C "$VLANG_SOURCE" || die 1 "This system is unable to compile vlang"
|
|
edebug "vlang has been sucessfully compiled"
|
|
elif [ -f "$VLANG_SOURCE/v" ]; then
|
|
edebug "vlang is already compiled, skipping compilation"
|
|
else
|
|
die 256 "Unexpected happend while compiling vlang source files"
|
|
fi
|
|
|
|
# Export executable
|
|
if [ ! -h "$VLANG_EXE" ] && [ ! -f "$VLANG_EXE" ]; then
|
|
ln -sf "$VLANG_SOURCE/v" "$VLANG_EXE" || die 1 "Unable to symlink vlang executable in '$VLANG_EXE'"
|
|
edebug "Vlang executable has been sucessfully symlinked"
|
|
elif [ -f "$VLANG_EXE" ]; then
|
|
die 1 "Pathname '$VLANG_EXE' is a file where symlink to compiled vlang compiler is expected"
|
|
elif [ -h "$VLANG_EXE" ]; then
|
|
edebug "Vlang executable is already symlinked, skipping.."
|
|
fi
|
|
|
|
# Create a new user-group for vlang users
|
|
if ! grep -qF vlang /etc/passwd 2>/dev/null; then
|
|
groupadd vlang || die 1 "Unable to make a new user-group 'vlang'"
|
|
edebug "Created a new user-group 'vlang'"
|
|
elif grep -qF vlang /etc/passwd 2>/dev/null; then
|
|
edebug "User-group 'vlang' already exists, skipping creation"
|
|
else
|
|
die 256 "Unexpected happend while creating new user-group 'vlang'"
|
|
fi
|
|
|
|
# Transfer ownership of VLANG_SOURCE to vlang user-group
|
|
if [ "$(stat -c '%G' "$VLANG_SOURCE")" != vlang ]; then
|
|
chown -R root:vlang "$VLANG_SOURCE" || die 1 "Unable to transfer ownership of '$VLANG_SOURCE' directory to vlang user-group"
|
|
edebug "Permission to '$VLANG_SOURCE' directory has been transfered to vlang user-group"
|
|
elif [ "$(stat -c '%G' "$VLANG_SOURCE")" = vlang ]; then
|
|
edebug "Directory '$VLANG_SOURCE' is already owned by 'vlang' user-group"
|
|
else
|
|
die 256 "Unexpected happend while transfering '$VLANG_SOURCE' directory to 'vlang' user-group"
|
|
fi
|
|
|
|
# Add gitpod user in vlang group
|
|
if ! groups | grep -qF "$VLANG_GROUP"; then
|
|
usermod -a -G "$VLANG_GROUP" gitpod || die 1 "Unable to transfer user 'gitpod' in user-group '$VLANG_GROUP'"
|
|
chmod -R 0775 "$VLANG_SOURCE" || die 1 "Unable to set ownership to '$VLANG_SOURCE"
|
|
edebug "User 'gitpod' has been added in user-group '$VLANG_GROUP'"
|
|
elif groups | grep -qF $VLANG_GROUP; then
|
|
edebug "User 'gitpod' is already in user-group '$VLANG_GROUP'"
|
|
else
|
|
die 256 "Unexpected happend while adding user 'gitpod' in user-group '$VLANG_GROUP'"
|
|
fi
|
|
|
|
# Selfcheck
|
|
# FIXME: Fix selfcheck
|
|
# su gitpod -c "$VLANG_EXE" help 1>/dev/null
|
|
|
|
# case "$?" in
|
|
# 0) printf 'INFO: %s\n' "builtin vlang selfcheck passed" ;;
|
|
# *) die "$?" "builtin vlang selfcheck failed"
|
|
# esac
|
|
|
|
# Master unset
|
|
unset VLANG_SOURCE VLANG_VERSION DIE_PREFIX CACHEDIR VLANG_EXE
|