Skip to content

Commit

Permalink
Merge pull request sinamics#613 from sinamics/fetch-depth
Browse files Browse the repository at this point in the history
Use sparse checkout during installation
  • Loading branch information
sinamics authored Dec 21, 2024
2 parents 48bdde2 + 33d05cb commit 00d768a
Show file tree
Hide file tree
Showing 4 changed files with 712 additions and 262 deletions.
38 changes: 29 additions & 9 deletions install.ztnet/bash/ztnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ fi
print_status "Updating apt..."

# update apt
$STD sudo apt update
$STD sudo apt-get update --no-list-cleanup -oAcquire::AllowInsecureRepositories=true

install_apt_packages() {
# Install required packages
Expand Down Expand Up @@ -949,21 +949,41 @@ setup_zerotier
pull_checkout_ztnet(){
# Change directory to the temporary installation directory
# Setup Ztnet
# Clone Ztnet repository into /opt folder
if [[ ! -d "$TEMP_REPO_DIR/.git" ]]; then
$STD git clone https://github.com/sinamics/ztnet.git $TEMP_REPO_DIR
print_status "Cloned Ztnet repository."
print_status "Initializing repository..."

# Initialize empty repo with a shallow clone
$STD git clone --depth 1 https://github.com/sinamics/ztnet.git $TEMP_REPO_DIR
cd "$TEMP_REPO_DIR"

# Set up sparse checkout
$STD git config core.sparseCheckout true

# Configure sparse-checkout to exclude specific directories
mkdir -p .git/info
cat > .git/info/sparse-checkout <<-EOF
/*
!/.devcontainer/*
!/.github/*
!/.vscode/*
!/install.ztnet/*
!/docs/*
docs/images/logo
EOF

# Update working tree
$STD git read-tree -mu HEAD
print_status "Cloned Ztnet repository (minimal version)."
else
print_status "$TEMP_REPO_DIR already exists. Updating the repository."
$STD git pull origin main
cd "$TEMP_REPO_DIR"
$STD git pull --depth 1 origin main
fi

cd "$TEMP_REPO_DIR"

if [[ -z "$BRANCH" ]]; then
# If BRANCH is empty or not set, checkout the latest tag or a custom version
git fetch --tags
latestTag=$(git describe --tags $(git rev-list --tags --max-count=1))
$STD git fetch --depth 1 --tags --force
latestTag=$($STD git describe --tags $(git rev-list --tags --max-count=1))
print_status "Checking out tag: ${CUSTOM_VERSION:-$latestTag}"
$STD git checkout "${CUSTOM_VERSION:-$latestTag}"
else
Expand Down
10 changes: 0 additions & 10 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@

/** @type {import("next").NextConfig} */
const config = {
experimental: {
instrumentationHook: true,
/**
*
* If any issues with "Compiler client unexpectedly exited with code: null and signal: SIGTERM" during build, try the following:
* https://github.com/sinamics/ztnet/issues/469
*/
// workerThreads: false,
// cpus: 1,
},
reactStrictMode: true,
swcMinify: true,
// https://nextjs.org/docs/advanced-features/output-file-tracing
Expand Down
Loading

0 comments on commit 00d768a

Please sign in to comment.