Skip to content

Commit

Permalink
Update script with FF changes
Browse files Browse the repository at this point in the history
Signed-off-by: Ulincsys <ulincsys@gmail.com>
  • Loading branch information
Ulincsys committed Sep 4, 2024
1 parent 51cebaa commit 47df77d
Showing 1 changed file with 39 additions and 11 deletions.
50 changes: 39 additions & 11 deletions scripts/install/workers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,25 @@ SCORECARD_DIR="$HOME/scorecard"
if [ -d "$SCORECARD_DIR" ]; then
echo " Scorecard directory already exists, would you like to skip cloning and building?"
echo " Only do this if Scorecard has been cloned and built in this directory before."
read -r -p "If you choose NO (the default), Everything in $SCORECARD_DIR will be DELETED [y/N]: " response
read -r -p "If you choose NO (the default), Scorecard will be updated [y/N]: " response
case "$response" in
[yY][eE][sS]|[yY])
echo " Skipping scorecard build"
;;
*)
echo " Cloning Scorecard ... "
rm -rf $SCORECARD_DIR
echo "Cloning OSSF Scorecard to generate scorecard data ..."
git clone https://github.com/ossf/scorecard $SCORECARD_DIR
cd $SCORECARD_DIR
echo "Updating OSSF Scorecard..."
CURRENT_DIR=$PWD;
cd $CURRENT_DIR
cd $SCORECARD_DIR;
cd $SCORECARD_DIR

# Check that dir is valid scorecard repo
SCORECARD_URL="$(git remote get-url origin || true)"
if [[ "$SCORECARD_URL" != *"ossf/scorecard"* ]]; then
echo "ERROR: $PWD is not an existing scorecard directory"
exit 127
fi

git pull
go mod tidy
go build;
echo "scorecard build done"
cd $CURRENT_DIR
Expand All @@ -79,11 +84,34 @@ if [ -d "$SCORECARD_DIR" ]; then
else
echo "Cloning OSSF Scorecard to generate scorecard data ..."
git clone https://github.com/ossf/scorecard $SCORECARD_DIR
cd $SCORECARD_DIR
CURRENT_DIR=$PWD;
cd $CURRENT_DIR
cd $SCORECARD_DIR;
cd $SCORECARD_DIR
go build;
echo "scorecard build done"
cd $CURRENT_DIR
fi

#Do the same thing for scc for value worker
SCC_DIR="$HOME/scc"
CURRENT_DIR=$PWD;

if [ -d "$SCC_DIR" ]; then
echo " Scc already exists, updating..."
cd $SCC_DIR
# Check that dir is valid scc repo
SCC_URL="$(git remote get-url origin || true)"
if [[ "$SCC_URL" != *"boyter/scc"* ]]; then
echo "ERROR: $PWD is not an existing scc directory"
exit 127
fi

git pull
else
echo "Cloning Sloc Cloc and Code (SCC) to generate value data ..."
git clone https://github.com/boyter/scc "$SCC_DIR"
cd $SCC_DIR
fi

go build;
echo "scc build done"
cd $CURRENT_DIR

0 comments on commit 47df77d

Please sign in to comment.