Lock down tool versions (downgrades if necessary)
This commit is contained in:
parent
3437982f70
commit
ff98c7cbe0
|
@ -0,0 +1,12 @@
|
|||
ANDROID_BUILD_TOOLS_VERSION=28.0.1
|
||||
ANDROID_NDK_VERSION=r10e
|
||||
ANDROID_PLATFORM_VERSION=android-27
|
||||
clojure_cli=1.9.0.381
|
||||
conan=1.9.0
|
||||
leiningen=2.8.1
|
||||
maven=3.5.2
|
||||
node=10.12.0
|
||||
nvm=0.33.11
|
||||
react_native_cli=2.0.1
|
||||
watchman=4.9.0
|
||||
yarn=1.13.0
|
17
Makefile
17
Makefile
|
@ -35,6 +35,8 @@ HELP_FUN = \
|
|||
print "\n"; \
|
||||
}
|
||||
|
||||
__read__toolversion__ = $(shell grep $(1) ./.TOOLVERSIONS | cut -d'=' -f2-)
|
||||
|
||||
# Main targets
|
||||
|
||||
clean: ##@prepare Remove all output folders
|
||||
|
@ -92,6 +94,21 @@ prepare-android: $(STATUS_GO_DRO_ARCH) ##@prepare Install and prepare Android-sp
|
|||
|
||||
prepare-mobile: prepare-android prepare-ios ##@prepare Install and prepare mobile platform specific dependencies
|
||||
|
||||
#----------------
|
||||
# Docker image
|
||||
#----------------
|
||||
docker-build-image: ##@docker build Docker image for debugging environment
|
||||
docker-compose -f docker-build/docker-compose.yml build \
|
||||
--build-arg="ANDROID_NDK_VERSION=$(call __read__toolversion__,ANDROID_NDK_VERSION)" \
|
||||
--build-arg="LEIN_VERSION=$(call __read__toolversion__,lein)" \
|
||||
--build-arg="NODE_VERSION=$(call __read__toolversion__,node)" \
|
||||
--build-arg="YARN_VERSION=$(call __read__toolversion__,yarn)" \
|
||||
--build-arg="REACT_NATIVE_CLI_VERSION=$(call __read__toolversion__,react_native_cli)" \
|
||||
adbd
|
||||
|
||||
docker-run: docker-build ##@docker run Docker container for debugging environment
|
||||
docker-compose -f docker-build/docker-compose.yml up
|
||||
|
||||
#----------------
|
||||
# Release builds
|
||||
#----------------
|
||||
|
|
|
@ -9,14 +9,6 @@ def cleanupAndDeps() {
|
|||
cmn.installJSDeps('desktop')
|
||||
}
|
||||
|
||||
def slackNotify(message, color = 'good') {
|
||||
slackSend(
|
||||
color: color,
|
||||
channel: '#jenkins-desktop',
|
||||
message: "develop (${env.CHANGE_BRANCH}) ${message} ${env.BUILD_URL}"
|
||||
)
|
||||
}
|
||||
|
||||
def buildClojureScript() {
|
||||
sh 'make prod-build-desktop'
|
||||
sh './scripts/build-desktop.sh buildClojureScript'
|
||||
|
|
|
@ -23,14 +23,16 @@ RUN cd /opt/android-sdk-linux && \
|
|||
sdkmanager "cmake;3.6.4111459"
|
||||
|
||||
RUN cd /opt/android-sdk-linux && \
|
||||
wget -q --output-document=sdk-platform-tools.zip 'https://dl.google.com/android/repository/platform-tools-latest-linux.zip' && \
|
||||
wget -q --output-document=sdk-platform-tools.zip 'https://dl.google.com/android/repository/platform-tools-latest-linux.zip' && \
|
||||
unzip sdk-platform-tools.zip && \
|
||||
rm -f sdk-platform-tools.zip
|
||||
|
||||
RUN wget -q --output-document=android-ndk.zip http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip && \
|
||||
unzip android-ndk.zip && \
|
||||
rm -f android-ndk.zip && \
|
||||
mv android-ndk-r10e android-ndk-linux
|
||||
ARG ANDROID_NDK_VERSION
|
||||
|
||||
RUN wget -q --output-document=android-ndk.zip "http://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip" && \
|
||||
unzip android-ndk.zip && \
|
||||
rm -f android-ndk.zip && \
|
||||
mv android-ndk-${ANDROID_NDK_VERSION} android-ndk-linux
|
||||
|
||||
RUN yes | sdkmanager --licenses
|
||||
|
||||
|
@ -41,12 +43,12 @@ RUN groupadd --gid 1000 node \
|
|||
|
||||
ENV NPM_CONFIG_LOGLEVEL info
|
||||
# that's the only version that doesn't hang on installing react-native-http inside docker
|
||||
ENV NODE_VERSION 10.14.0
|
||||
ARG NODE_VERSION=10.14.0
|
||||
ENV NODE_ENV development
|
||||
|
||||
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
|
||||
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
|
||||
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" \
|
||||
RUN curl -SLO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
||||
&& tar -xJf "node-v${NODE_VERSION}-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
|
||||
&& rm "node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
||||
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
|
||||
|
||||
# END install Node JS
|
||||
|
@ -56,21 +58,23 @@ ENV TERM dumb
|
|||
|
||||
# Install Lein
|
||||
# Check out latest releases from https://github.com/technomancy/leiningen/releases
|
||||
ENV LEIN_VERSION=2.8.1
|
||||
ARG LEIN_VERSION
|
||||
ENV LEIN_INSTALL=/usr/local/bin/
|
||||
|
||||
RUN mkdir -p $LEIN_INSTALL \
|
||||
&& wget -q https://raw.githubusercontent.com/technomancy/leiningen/$LEIN_VERSION/bin/lein-pkg \
|
||||
&& wget -q https://raw.githubusercontent.com/technomancy/leiningen/${LEIN_VERSION}/bin/lein-pkg \
|
||||
&& mv lein-pkg $LEIN_INSTALL/lein \
|
||||
&& chmod 0755 $LEIN_INSTALL/lein \
|
||||
&& wget -q https://github.com/technomancy/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.zip \
|
||||
&& wget -q https://github.com/technomancy/leiningen/releases/download/${LEIN_VERSION}/leiningen-${LEIN_VERSION}-standalone.zip \
|
||||
&& mkdir -p /usr/share/java \
|
||||
&& mv leiningen-$LEIN_VERSION-standalone.zip /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar
|
||||
&& mv leiningen-${LEIN_VERSION}-standalone.zip /usr/share/java/leiningen-${LEIN_VERSION}-standalone.jar
|
||||
|
||||
# Install React-Native
|
||||
RUN npm install -g react-native-cli
|
||||
ARG REACT_NATIVE_CLI_VERSION
|
||||
RUN npm install -g react-native-cli@${REACT_NATIVE_CLI_VERSION}
|
||||
# Install Yarn
|
||||
RUN npm install -g yarn@1.13.0
|
||||
ARG YARN_VERSION
|
||||
RUN npm install -g yarn@${YARN_VERSION}
|
||||
|
||||
# Add files needed for installing dependencies
|
||||
# Use directory /build for that purpose
|
||||
|
@ -78,28 +82,21 @@ WORKDIR /build
|
|||
|
||||
ADD .env.jenkins .env
|
||||
|
||||
ADD ./project.clj ./
|
||||
|
||||
ADD ./package.json package-lock.json ./
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
ADD . ./
|
||||
|
||||
RUN make setup
|
||||
RUN make prepare
|
||||
RUN export ANDROID_SDK_ROOT=/opt/android-sdk-linux && \
|
||||
rm ./android/local.properties && make setup && make prepare-android
|
||||
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
|
||||
RUN keytool -genkey -v -keystore status-im.keystore -storepass password -alias status -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=mqttserver.ibm.com, OU=ID, O=IBM, L=Hursley, S=Hants, C=GB" -keypass password
|
||||
RUN mkdir -p /root/.gradle
|
||||
RUN mv status-im.keystore /root/.gradle/
|
||||
RUN keytool -genkey -v -keystore status-im.keystore -storepass password -alias status -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=mqttserver.ibm.com, OU=ID, O=IBM, L=Hursley, S=Hants, C=GB" -keypass password && \
|
||||
mkdir -p /root/.gradle && \
|
||||
mv status-im.keystore /root/.gradle/
|
||||
|
||||
RUN echo "sdk.dir=/opt/android-sdk-linux" >> android/local.properties && \
|
||||
echo "ndk.dir=/opt/android-ndk-linux" >> android/local.properties
|
||||
|
||||
RUN echo "sdk.dir=/opt/android-sdk-linux" >> android/local.properties
|
||||
RUN echo "ndk.dir=/opt/android-ndk-linux" >> android/local.properties
|
||||
|
||||
RUN cd ./android && ./gradlew react-native-android:installArchives
|
||||
RUN cd ./android && ./gradlew assembleRelease
|
||||
RUN cd ./android && ./gradlew react-native-android:installArchives && \
|
||||
./gradlew assembleRelease
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Build
|
||||
|
||||
``` shell
|
||||
docker-compose -f docker-build/docker-compose.yml build
|
||||
make docker-build
|
||||
```
|
||||
|
||||
This will install all the required sdks, depending on the connection will take some time.
|
||||
|
@ -9,7 +9,7 @@ This will install all the required sdks, depending on the connection will take s
|
|||
# Run
|
||||
|
||||
``` shell
|
||||
docker-compose -f docker-build/docker-compose.yml up
|
||||
make docker-run
|
||||
```
|
||||
|
||||
This will start `adbd` and `fighwheel` listening on port `4567`.
|
||||
|
|
|
@ -44,6 +44,10 @@ external_fonts=( \
|
|||
'../../../../../resources/fonts/Inter-UI-Regular.otf' \
|
||||
)
|
||||
|
||||
source "$SCRIPTPATH/lib/setup/path-support.sh"
|
||||
|
||||
source_lib "packages.sh"
|
||||
|
||||
function is_macos() {
|
||||
[[ "$OS" =~ Darwin ]]
|
||||
}
|
||||
|
@ -56,11 +60,6 @@ function is_windows_target() {
|
|||
[[ "$TARGET_SYSTEM_NAME" =~ Windows ]]
|
||||
}
|
||||
|
||||
function program_exists() {
|
||||
local program=$1
|
||||
command -v "$program" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
function joinPath() {
|
||||
if program_exists 'realpath'; then
|
||||
realpath -m "$1/$2"
|
||||
|
@ -127,7 +126,7 @@ function init() {
|
|||
fi
|
||||
|
||||
echo "${RED}Conan package manager not found. Installing...${NC}"
|
||||
pip3 install conan==1.9.0
|
||||
pip3 install conan==$(get_tool_version conan)
|
||||
fi
|
||||
|
||||
conan remote add --insert 0 -f status-im https://conan.status.im
|
||||
|
|
|
@ -52,7 +52,7 @@ function install_and_setup_package_manager() {
|
|||
|
||||
function install_wget() {
|
||||
if is_macos; then
|
||||
brew_install wget
|
||||
brew_install wget 1.19.4 0505e48743f82ac2e9f5d0c9d6d811949982262e
|
||||
fi
|
||||
# it's installed on ubuntu/debian by default
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ EOF
|
|||
|
||||
function install_leiningen() {
|
||||
if is_macos; then
|
||||
brew_install leiningen
|
||||
brew_install leiningen $(get_tool_version leiningen) f7e10afc6d04a13d28e825db71326d16c12e9724
|
||||
elif is_linux; then
|
||||
install_leiningen_linux
|
||||
fi
|
||||
|
@ -88,8 +88,8 @@ function install_leiningen() {
|
|||
|
||||
function install_leiningen_linux() {
|
||||
local destination=/usr/bin/lein
|
||||
|
||||
if ! program_exists "lein"; then
|
||||
local required_version=$(get_tool_version leiningen)
|
||||
if ! program_version_exists "lein" "$required_version"; then
|
||||
cecho "@b@blue[[+ Installing lein...]]"
|
||||
|
||||
sudo su << EOF
|
||||
|
@ -99,7 +99,7 @@ function install_leiningen_linux() {
|
|||
|
||||
chmod 755 $destination
|
||||
|
||||
cd $HOME && lein upgrade
|
||||
cd $HOME && lein downgrade $required_version
|
||||
EOF
|
||||
else
|
||||
already_installed "lein"
|
||||
|
@ -108,20 +108,23 @@ EOF
|
|||
|
||||
function install_clojure_cli() {
|
||||
if is_macos; then
|
||||
brew_install clojure
|
||||
local required_version=$(get_tool_version clojure_cli)
|
||||
brew_install clojure $required_version 90ea0cb4b194282b5906108dcec522c5a1ed7ce0
|
||||
elif is_linux; then
|
||||
install_clojure_cli_linux
|
||||
fi
|
||||
}
|
||||
|
||||
function install_clojure_cli_linux() {
|
||||
if ! program_exists "lein"; then
|
||||
local required_version=$(get_tool_version clojure_cli)
|
||||
|
||||
if ! program_exists "clojure" || ! echo "$(clj -r <<< '(System/exit 0)')" | grep -q -o ${required_version%.*}; then
|
||||
cecho "@b@blue[[+ Installing Clojure CLI...]]"
|
||||
|
||||
local current_dir=$(pwd)
|
||||
sudo su << EOF
|
||||
curl --silent \
|
||||
https://download.clojure.org/install/linux-install-1.9.0.381.sh \
|
||||
https://download.clojure.org/install/linux-install-${required_version}.sh \
|
||||
-o /tmp/clojure
|
||||
|
||||
chmod +x /tmp/clojure
|
||||
|
@ -135,16 +138,17 @@ EOF
|
|||
}
|
||||
|
||||
function install_watchman() {
|
||||
local required_version=$(get_tool_version watchman)
|
||||
if is_macos; then
|
||||
brew_install watchman
|
||||
brew_install watchman $required_version 1a41406af8db6bbc0c94811cf60043a7436be3c4
|
||||
elif is_linux; then
|
||||
if ! program_exists "watchman"; then
|
||||
if ! program_version_exists "watchman" "$required_version"; then
|
||||
local current_dir=$(pwd)
|
||||
local clone_path="/tmp/watchman"
|
||||
|
||||
git clone https://github.com/facebook/watchman.git $clone_path
|
||||
cd $clone_path
|
||||
git checkout v4.9.0
|
||||
git checkout v$required_version
|
||||
./autogen.sh && \
|
||||
./configure && \
|
||||
make && \
|
||||
|
@ -189,74 +193,80 @@ function install_android_sdk_linux() {
|
|||
}
|
||||
|
||||
function install_maven() {
|
||||
brew_install maven
|
||||
local required_version=$(get_tool_version maven)
|
||||
brew_install maven $required_version 4c23c22dc71eadaeb7b25d6e6c10fd53bfc26976
|
||||
linux_install maven
|
||||
}
|
||||
|
||||
function install_react_native_cli() {
|
||||
cd "$(repo_path)"
|
||||
|
||||
local npm_command="npm"
|
||||
local npm_command='npm'
|
||||
local required_version=$(get_tool_version react_native_cli)
|
||||
|
||||
if is_linux && ! nvm_installed; then
|
||||
# aptitude version of node requires sudo for global install
|
||||
npm_command="sudo npm"
|
||||
npm_command="sudo $npm_command"
|
||||
fi
|
||||
|
||||
if npm list -g | grep -q react-native-cli; then
|
||||
already_installed "react-native-cli"
|
||||
if npm list -g "react-native-cli@{required_version}" &>/dev/null; then
|
||||
already_installed "react-native-cli@{required_version}"
|
||||
else
|
||||
$npm_command install -g react-native-cli
|
||||
$npm_command install -g react-native-cli@${required_version}
|
||||
fi
|
||||
}
|
||||
|
||||
function install_yarn() {
|
||||
local expected_version='1.13.0'
|
||||
local required_version=$(get_tool_version yarn)
|
||||
if ! program_exists "yarn"; then
|
||||
npm install -g yarn@$expected_version # Install the expected yarn version
|
||||
npm install -g yarn@$required_version # Install the required yarn version
|
||||
else
|
||||
cecho "+ yarn already installed... skipping."
|
||||
fi
|
||||
|
||||
if program_exists "yarn"; then
|
||||
local yarn_version=$(yarn -v)
|
||||
if [[ $yarn_version != "$expected_version" ]]; then
|
||||
cecho "@b@red[[+ yarn version $yarn_version is installed. yarn version $expected_version is recommended.]]"
|
||||
exit 1
|
||||
if [[ $yarn_version != "$required_version" ]]; then
|
||||
cecho "@b@yellow[[+ yarn version $yarn_version is installed. Downloading yarn version $required_version in the local repo.]]"
|
||||
yarn policies set-version $required_version
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function install_node_via_nvm() {
|
||||
local nvmrc="$(repo_path)/.nvmrc"
|
||||
local required_version=$(get_tool_version node)
|
||||
|
||||
cd "$(repo_path)"
|
||||
|
||||
if [ ! -e "$nvmrc" ]; then
|
||||
cecho "@b@blue[[+ Installing Node 10]]"
|
||||
if [ ! -e "$nvmrc" -o "$(nvm version v""$required_version"")" = "N/A" ]; then
|
||||
cecho "@b@blue[[+ Installing Node $required_version]]"
|
||||
|
||||
nvm install 10.14.0
|
||||
nvm alias status-im 10.14.0
|
||||
nvm install $required_version
|
||||
nvm alias status-im $required_version
|
||||
echo status-im > "$nvmrc"
|
||||
|
||||
nvm use status-im
|
||||
|
||||
else
|
||||
local version_alias=$(cat "$nvmrc")
|
||||
if [ "$(nvm version status-im)" != "v$required_version" ]; then
|
||||
nvm alias status-im $required_version
|
||||
fi
|
||||
nvm use $version_alias
|
||||
|
||||
local version=$(node -v)
|
||||
cecho "+ Node already installed ($version_alias $version via NVM)... skipping."
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function install_node_via_package_manager() {
|
||||
if ! program_exists "node"; then
|
||||
local required_version=$(get_tool_version node)
|
||||
if ! program_version_exists "node" "v$required_version"; then
|
||||
if is_macos; then
|
||||
brew_install node
|
||||
brew_install node "$required_version" b801cc6b71e7c09448b4f823e493710665de68eb
|
||||
elif is_linux; then
|
||||
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
|
||||
curl -sL https://deb.nodesource.com/setup_${required_version%%\.*}.x | sudo -E bash -
|
||||
linux_update
|
||||
|
||||
linux_install nodejs
|
||||
|
@ -339,6 +349,11 @@ function use_android_sdk() {
|
|||
if ! grep -Fq "sdk.dir" $_localPropertiesPath; then
|
||||
echo "sdk.dir=$ANDROID_SDK_ROOT" | tee -a $_localPropertiesPath
|
||||
fi
|
||||
|
||||
local ANDROID_BUILD_TOOLS_VERSION=$(get_tool_version ANDROID_BUILD_TOOLS_VERSION)
|
||||
local ANDROID_PLATFORM_VERSION=$(get_tool_version ANDROID_PLATFORM_VERSION)
|
||||
touch ~/.android/repositories.cfg
|
||||
echo y | sdkmanager "platform-tools" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" "platforms;$ANDROID_PLATFORM_VERSION"
|
||||
else
|
||||
local _docUrl="https://status.im/build_status/"
|
||||
cecho "@yellow[[ANDROID_SDK_ROOT environment variable not defined, please install the Android SDK.]]"
|
||||
|
@ -363,7 +378,8 @@ function install_android_ndk() {
|
|||
PLATFORM="darwin"
|
||||
fi
|
||||
|
||||
downloadUrl . android-ndk.zip https://dl.google.com/android/repository/android-ndk-r10e-$PLATFORM-x86_64.zip && \
|
||||
local ANDROID_NDK_VERSION=$(get_tool_version ANDROID_NDK_VERSION)
|
||||
downloadUrl . android-ndk.zip https://dl.google.com/android/repository/android-ndk-$ANDROID_NDK_VERSION-$PLATFORM-x86_64.zip && \
|
||||
cecho "@cyan[[Extracting Android NDK to $_ndkParentDir.]]" && \
|
||||
unzip -q -o ./android-ndk.zip -d "$_ndkParentDir" && \
|
||||
rm -f ./android-ndk.zip && \
|
||||
|
|
|
@ -9,6 +9,31 @@ function program_exists() {
|
|||
command -v "$program" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
function program_version_exists() {
|
||||
local program=$1
|
||||
if ! program_exists "$program"; then
|
||||
$(exit 1)
|
||||
return
|
||||
fi
|
||||
|
||||
local required_version=$2
|
||||
if echo "$($program --version)" | grep -q -wo "$required_version\|$required_version[^\.]"; then
|
||||
$(exit 0)
|
||||
return
|
||||
fi
|
||||
$(exit 1)
|
||||
}
|
||||
|
||||
function get_tool_version() {
|
||||
local toolName=$1
|
||||
local version=`grep "^$toolName" ./.TOOLVERSIONS | cut -d'=' -f2-`
|
||||
if [ -z "$version" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $version
|
||||
}
|
||||
|
||||
|
||||
|
||||
########
|
||||
|
@ -17,16 +42,37 @@ function program_exists() {
|
|||
|
||||
function brew_install() {
|
||||
local package=$1
|
||||
local required_version=$2
|
||||
local url="https://raw.githubusercontent.com/Homebrew/homebrew-core/${3:-master}/Formula/$package.rb"
|
||||
|
||||
if ! is_macos; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if brew list "$package" > /dev/null 2>&1; then
|
||||
already_installed "$package"
|
||||
else
|
||||
brew install $@
|
||||
local pkginfo=$(brew info "$package")
|
||||
if [ $? -eq 0 ]; then
|
||||
# Package already exists locally
|
||||
local prefix_expr="HOMEBREW_PREFIX: "
|
||||
local brew_base=$(brew config | grep "$prefix_expr" | sed "s|$prefix_expr||")
|
||||
local pkg_base="$brew_base/Cellar/$package/"
|
||||
local installed_versions=$(echo "$pkginfo" | grep "$pkg_base" | sed -E "s:$pkg_base([^ ]+).*$:\1:")
|
||||
local active_version=$(echo "$pkginfo" | grep -E "$pkg_base.*\*$" | sed -E "s:$pkg_base([^ ]+).*\*$:\1:")
|
||||
|
||||
for installed_version in $installed_versions;
|
||||
do
|
||||
if [ "$installed_version" = "$required_version" ]; then
|
||||
if [ "$active_version" = "$required_version" ]; then
|
||||
already_installed "$package $required_version"
|
||||
else
|
||||
brew unlink "$package"
|
||||
brew switch "$package" "$required_version"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
brew install $url
|
||||
}
|
||||
|
||||
function brew_cask_install() {
|
||||
|
@ -60,45 +106,45 @@ function brew_tap() {
|
|||
###############
|
||||
|
||||
function linux_update() {
|
||||
! is_linux && return 1
|
||||
! is_linux && return 1
|
||||
|
||||
if program_exists "apt"; then
|
||||
apt_update
|
||||
elif program_exists "pacman"; then
|
||||
pacman_update
|
||||
else
|
||||
echo "Unsupported Linux distro."
|
||||
exit 1;
|
||||
fi
|
||||
if program_exists "apt"; then
|
||||
apt_update
|
||||
elif program_exists "pacman"; then
|
||||
pacman_update
|
||||
else
|
||||
echo "Unsupported Linux distro."
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
function linux_is_installed() {
|
||||
! is_linux && return 1
|
||||
! is_linux && return 1
|
||||
|
||||
if program_exists "apt"; then
|
||||
apt_is_installed "$@"
|
||||
elif program_exists "pacman"; then
|
||||
pacman_is_installed "$@"
|
||||
else
|
||||
echo "Unsupported Linux distro."
|
||||
exit 1;
|
||||
fi
|
||||
if program_exists 'apt'; then
|
||||
apt_is_installed "$@"
|
||||
elif program_exists 'pacman'; then
|
||||
pacman_is_installed "$@"
|
||||
else
|
||||
echo "Unsupported Linux distro."
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
# FIXME This command assumes that package names in different package managers (apt, pacman) are same.
|
||||
# At this moment, it works as expected because we only call it for installing maven and nodejs.
|
||||
# If this list grows, please consider adding some sort of mapping mechanism.
|
||||
function linux_install() {
|
||||
! is_linux && return 1
|
||||
! is_linux && return 1
|
||||
|
||||
if program_exists "apt"; then
|
||||
apt_install "$@"
|
||||
elif program_exists "pacman"; then
|
||||
pacman_install "$@"
|
||||
else
|
||||
echo "Unsupported Linux distro."
|
||||
exit 1;
|
||||
fi
|
||||
if program_exists "apt"; then
|
||||
apt_install "$@"
|
||||
elif program_exists "pacman"; then
|
||||
pacman_install "$@"
|
||||
else
|
||||
echo "Unsupported Linux distro."
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,7 +168,7 @@ function apt_install() {
|
|||
if apt_is_installed "$package"; then
|
||||
cecho "+ $package already installed... skipping."
|
||||
else
|
||||
sudo apt install -y "$package"
|
||||
sudo apt install -y "$package" || exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -131,22 +177,22 @@ function apt_install() {
|
|||
###############
|
||||
|
||||
function pacman_update() {
|
||||
sudo pacman -Syu
|
||||
sudo pacman -Syu
|
||||
}
|
||||
|
||||
function pacman_is_installed() {
|
||||
local package=$1
|
||||
pacman -Qs $package >/dev/null 2>&1
|
||||
local package=$1
|
||||
pacman -Qs $package >/dev/null 2>&1
|
||||
}
|
||||
|
||||
function pacman_install() {
|
||||
local package=$1
|
||||
local package=$1
|
||||
|
||||
if pacman_is_installed "$package"; then
|
||||
cecho "+ $package already installed... skipping."
|
||||
else
|
||||
sudo pacman -S --noconfirm "$package"
|
||||
fi
|
||||
if pacman_is_installed "$package"; then
|
||||
cecho "+ $package already installed... skipping."
|
||||
else
|
||||
sudo pacman -S --noconfirm "$package" || exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
###############
|
||||
|
|
|
@ -6,13 +6,13 @@ YELLOW='\033[1;33m'
|
|||
NC='\033[0m'
|
||||
PLATFORM=""
|
||||
|
||||
EXPECTED_NODE_VERSION="v10.14.0" # note the 'v' in front, that is how node does versioning
|
||||
EXPECTED_YARN_VERSION="1.13.0" # note the lack of 'v' in front. inconsistent. :(
|
||||
_current_dir=$(cd "${BASH_SOURCE%/*}" && pwd)
|
||||
source "$_current_dir/lib/setup/path-support.sh"
|
||||
|
||||
function program_exists() {
|
||||
local program=$1
|
||||
command -v "$program" >/dev/null 2>&1
|
||||
}
|
||||
source_lib "packages.sh"
|
||||
|
||||
EXPECTED_NODE_VERSION="v$(get_tool_version node)" # note the 'v' in front, that is how node does versioning
|
||||
EXPECTED_YARN_VERSION="$(get_tool_version yarn)" # note the lack of 'v' in front. inconsistent. :(
|
||||
|
||||
#if no arguments passed, inform user about possible ones
|
||||
|
||||
|
|
Loading…
Reference in New Issue