refactor: rename CLI binary from lab to labctl
Updated everywhere: constants, package.json bin, completions, nfpm packaging, build scripts, CI, banner text. Binary is now /usr/bin/labctl. Internal package names (@lab/*) unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,7 @@ usage() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") [OPTIONS]
|
||||
|
||||
Build lab binary and produce RPM/DEB packages.
|
||||
Build labctl binary and produce RPM/DEB packages.
|
||||
|
||||
Options:
|
||||
--arch ARCH Target architecture: x86_64 or arm64 (default: host arch)
|
||||
@@ -106,7 +106,7 @@ build_arch() {
|
||||
|
||||
bun_target="$(bun_target_for "$arch")"
|
||||
nfpm_arch="$(nfpm_arch_for "$arch")"
|
||||
binary_name="dist/lab-${arch}"
|
||||
binary_name="dist/labctl-${arch}"
|
||||
|
||||
echo ""
|
||||
echo "==> Bundling standalone binary for ${arch}..."
|
||||
@@ -117,7 +117,7 @@ build_arch() {
|
||||
local tmpconfig
|
||||
tmpconfig="$(mktemp /tmp/nfpm-XXXXXX.yaml)"
|
||||
sed -e "s|^arch:.*|arch: ${nfpm_arch}|" \
|
||||
-e "s|src: ./dist/lab$|src: ./${binary_name}|" \
|
||||
-e "s|src: ./dist/labctl$|src: ./${binary_name}|" \
|
||||
nfpm.yaml > "$tmpconfig"
|
||||
|
||||
nfpm pkg --config "$tmpconfig" --packager rpm --target dist/
|
||||
@@ -125,7 +125,7 @@ build_arch() {
|
||||
|
||||
local rpm_arch
|
||||
rpm_arch="$(rpm_arch_for "$arch")"
|
||||
RPM_FILE=$(ls dist/lab-*.${rpm_arch}.rpm 2>/dev/null | head -1)
|
||||
RPM_FILE=$(ls dist/labctl-*.${rpm_arch}.rpm 2>/dev/null | head -1)
|
||||
echo "==> Built: $RPM_FILE"
|
||||
echo " Size: $(du -h "$RPM_FILE" | cut -f1)"
|
||||
|
||||
@@ -136,13 +136,13 @@ build_arch() {
|
||||
|
||||
tmpconfig="$(mktemp /tmp/nfpm-XXXXXX.yaml)"
|
||||
sed -e "s|^arch:.*|arch: ${nfpm_arch}|" \
|
||||
-e "s|src: ./dist/lab$|src: ./${binary_name}|" \
|
||||
-e "s|src: ./dist/labctl$|src: ./${binary_name}|" \
|
||||
nfpm.yaml > "$tmpconfig"
|
||||
|
||||
nfpm pkg --config "$tmpconfig" --packager deb --target dist/
|
||||
rm -f "$tmpconfig"
|
||||
|
||||
DEB_FILE=$(ls dist/lab_*_${deb_arch}.deb 2>/dev/null | head -1)
|
||||
DEB_FILE=$(ls dist/labctl_*_${deb_arch}.deb 2>/dev/null | head -1)
|
||||
echo "==> Built: $DEB_FILE"
|
||||
echo " Size: $(du -h "$DEB_FILE" | cut -f1)"
|
||||
}
|
||||
@@ -162,7 +162,7 @@ echo "==> Generating shell completions..."
|
||||
pnpm completions:generate
|
||||
|
||||
mkdir -p dist
|
||||
rm -f dist/lab dist/lab-x86_64 dist/lab-arm64 dist/lab-*.rpm dist/lab*.deb
|
||||
rm -f dist/labctl dist/labctl-x86_64 dist/labctl-arm64 dist/labctl-*.rpm dist/labctl*.deb
|
||||
|
||||
if [ "$BUILD_ALL" = true ]; then
|
||||
build_arch "x86_64"
|
||||
@@ -177,4 +177,4 @@ fi
|
||||
|
||||
echo ""
|
||||
echo "==> Build complete. Artifacts in dist/:"
|
||||
ls -lh dist/lab* 2>/dev/null || echo " (none)"
|
||||
ls -lh dist/labctl* 2>/dev/null || echo " (none)"
|
||||
|
||||
@@ -330,29 +330,29 @@ async function main(): Promise<void> {
|
||||
const bashContent = generateBash(tree);
|
||||
|
||||
const completionsDir = join(ROOT, 'completions');
|
||||
const fishPath = join(completionsDir, 'lab.fish');
|
||||
const bashPath = join(completionsDir, 'lab.bash');
|
||||
const fishPath = join(completionsDir, 'labctl.fish');
|
||||
const bashPath = join(completionsDir, 'labctl.bash');
|
||||
|
||||
if (mode === '--check') {
|
||||
let stale = false;
|
||||
try {
|
||||
const currentFish = readFileSync(fishPath, 'utf-8');
|
||||
if (currentFish !== fishContent) {
|
||||
console.error('completions/lab.fish is stale');
|
||||
console.error('completions/labctl.fish is stale');
|
||||
stale = true;
|
||||
}
|
||||
} catch {
|
||||
console.error('completions/lab.fish does not exist');
|
||||
console.error('completions/labctl.fish does not exist');
|
||||
stale = true;
|
||||
}
|
||||
try {
|
||||
const currentBash = readFileSync(bashPath, 'utf-8');
|
||||
if (currentBash !== bashContent) {
|
||||
console.error('completions/lab.bash is stale');
|
||||
console.error('completions/labctl.bash is stale');
|
||||
stale = true;
|
||||
}
|
||||
} catch {
|
||||
console.error('completions/lab.bash does not exist');
|
||||
console.error('completions/labctl.bash does not exist');
|
||||
stale = true;
|
||||
}
|
||||
if (stale) {
|
||||
@@ -373,9 +373,9 @@ async function main(): Promise<void> {
|
||||
}
|
||||
|
||||
// Default: print to stdout
|
||||
console.log('=== completions/lab.fish ===');
|
||||
console.log('=== completions/labctl.fish ===');
|
||||
console.log(fishContent);
|
||||
console.log('=== completions/lab.bash ===');
|
||||
console.log('=== completions/labctl.bash ===');
|
||||
console.log(bashContent);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ if [ -z "$GITEA_TOKEN" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEB_FILE=$(ls dist/lab*.deb 2>/dev/null | head -1)
|
||||
DEB_FILE=$(ls dist/labctl*.deb 2>/dev/null | head -1)
|
||||
if [ -z "$DEB_FILE" ]; then
|
||||
echo "Error: No DEB found in dist/. Run scripts/build-rpm.sh first."
|
||||
exit 1
|
||||
@@ -63,10 +63,10 @@ echo "==> Published successfully!"
|
||||
|
||||
# Ensure package is linked to the repository
|
||||
source "$SCRIPT_DIR/link-package.sh"
|
||||
link_package "debian" "lab"
|
||||
link_package "debian" "labctl"
|
||||
|
||||
echo ""
|
||||
echo "Install with:"
|
||||
echo " echo \"deb ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/debian trixie main\" | sudo tee /etc/apt/sources.list.d/lab.list"
|
||||
echo " curl -fsSL ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/debian/repository.key | sudo gpg --dearmor -o /etc/apt/keyrings/lab.gpg"
|
||||
echo " sudo apt update && sudo apt install lab"
|
||||
echo " echo \"deb ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/debian trixie main\" | sudo tee /etc/apt/sources.list.d/labctl.list"
|
||||
echo " curl -fsSL ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/debian/repository.key | sudo gpg --dearmor -o /etc/apt/keyrings/labctl.gpg"
|
||||
echo " sudo apt update && sudo apt install labctl"
|
||||
|
||||
@@ -21,7 +21,7 @@ if [ -z "$GITEA_TOKEN" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RPM_FILE=$(ls dist/lab-*.rpm 2>/dev/null | head -1)
|
||||
RPM_FILE=$(ls dist/labctl-*.rpm 2>/dev/null | head -1)
|
||||
if [ -z "$RPM_FILE" ]; then
|
||||
echo "Error: No RPM found in dist/. Run scripts/build-rpm.sh first."
|
||||
exit 1
|
||||
@@ -35,13 +35,13 @@ echo "==> Publishing $RPM_FILE (version $RPM_VERSION) to ${GITEA_URL}..."
|
||||
# Check if version already exists and delete it first
|
||||
EXISTING=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/packages/${GITEA_OWNER}/rpm/lab/${RPM_VERSION}")
|
||||
"${GITEA_URL}/api/v1/packages/${GITEA_OWNER}/rpm/labctl/${RPM_VERSION}")
|
||||
|
||||
if [ "$EXISTING" = "200" ]; then
|
||||
echo "==> Version $RPM_VERSION already exists, replacing..."
|
||||
curl -s -o /dev/null -X DELETE \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${GITEA_URL}/api/v1/packages/${GITEA_OWNER}/rpm/lab/${RPM_VERSION}"
|
||||
"${GITEA_URL}/api/v1/packages/${GITEA_OWNER}/rpm/labctl/${RPM_VERSION}"
|
||||
fi
|
||||
|
||||
# Upload
|
||||
@@ -55,8 +55,8 @@ echo "==> Published successfully!"
|
||||
|
||||
# Ensure package is linked to the repository
|
||||
source "$SCRIPT_DIR/link-package.sh"
|
||||
link_package "rpm" "lab"
|
||||
link_package "rpm" "labctl"
|
||||
|
||||
echo ""
|
||||
echo "Install with:"
|
||||
echo " sudo dnf install lab # if repo already configured"
|
||||
echo " sudo dnf install labctl # if repo already configured"
|
||||
|
||||
@@ -36,12 +36,12 @@ echo ""
|
||||
# 5. Install locally (Fedora/RHEL only)
|
||||
if [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ]; then
|
||||
echo "==> Installing locally..."
|
||||
RPM_FILE=$(ls dist/lab-*.rpm 2>/dev/null | head -1)
|
||||
RPM_FILE=$(ls dist/labctl-*.rpm 2>/dev/null | head -1)
|
||||
if [ -n "$RPM_FILE" ]; then
|
||||
sudo rpm -U --force "$RPM_FILE"
|
||||
echo ""
|
||||
echo "==> Installed:"
|
||||
lab --version || echo "(lab binary installed)"
|
||||
labctl --version || echo "(labctl binary installed)"
|
||||
else
|
||||
echo "==> WARNING: No RPM found in dist/, skipping local install."
|
||||
fi
|
||||
@@ -61,12 +61,12 @@ echo "=== Done! ==="
|
||||
echo ""
|
||||
echo "RPM install:"
|
||||
echo " sudo dnf config-manager --add-repo ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/rpm.repo"
|
||||
echo " sudo dnf install lab"
|
||||
echo " sudo dnf install labctl"
|
||||
echo ""
|
||||
echo "DEB install (Debian/Ubuntu):"
|
||||
echo " echo \"deb ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/debian trixie main\" | sudo tee /etc/apt/sources.list.d/lab.list"
|
||||
echo " curl -fsSL ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/debian/repository.key | sudo gpg --dearmor -o /etc/apt/keyrings/lab.gpg"
|
||||
echo " sudo apt update && sudo apt install lab"
|
||||
echo " echo \"deb ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/debian trixie main\" | sudo tee /etc/apt/sources.list.d/labctl.list"
|
||||
echo " curl -fsSL ${GITEA_PUBLIC_URL}/api/packages/${GITEA_OWNER}/debian/repository.key | sudo gpg --dearmor -o /etc/apt/keyrings/labctl.gpg"
|
||||
echo " sudo apt update && sudo apt install labctl"
|
||||
echo ""
|
||||
echo "Docker image:"
|
||||
echo " podman pull ${REGISTRY}/michal/lab-bastion:${VERSION}"
|
||||
|
||||
Reference in New Issue
Block a user