all: Update build scripts
parent
d027f99e2d
commit
9d8190ac21
|
@ -1,35 +1,65 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Step 1: Build the Angular module
|
|
||||||
ng build --prod > /dev/null 2>&1
|
|
||||||
RET=$?
|
|
||||||
|
|
||||||
if [[ $RET -ne 0 ]]; then
|
|
||||||
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "[*] Angular Build Succeeded"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Copy the required files to the build output
|
|
||||||
MODULENAME=$(basename $PWD)
|
MODULENAME=$(basename $PWD)
|
||||||
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
|
|
||||||
# Step 3: Clean up
|
check_workspace() {
|
||||||
rm -rf dist/$MODULENAME/bundles/*.map
|
if [[ ! -d "node_modules" ]]; then
|
||||||
rm -rf dist/$MODULENAME/bundles/*.min*
|
while true; do
|
||||||
rm -rf bundletmp
|
read -p "[!!] The Angular workspace has not been prepared. Would you like to do it now? [Y\n] " yn
|
||||||
mv dist/$MODULENAME/bundles/ bundletmp
|
case $yn in
|
||||||
rm -rf dist/$MODULENAME/*
|
[Yy]* ) prepare_workspace; break;;
|
||||||
mv bundletmp/* dist/$MODULENAME/
|
[Nn]* ) exit 1;;
|
||||||
rm -rf bundletmp
|
* ) prepare_workspace; break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Step 4: Package (Optional)
|
prepare_workspace() {
|
||||||
if [[ $1 == "package" ]]; then
|
echo "[*] Preparing the Angular workspace."
|
||||||
|
|
||||||
|
if ! command -v npm &> /dev/null; then
|
||||||
|
echo "[!] NPM does not appear to be installed on this system. Failed to create workspace."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! npm install &> /dev/null; then
|
||||||
|
echo "[!] Failed to prepare workspace. Run npm install to see why."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Prepared the Angular workspace successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
build_module() {
|
||||||
|
ng build --prod > /dev/null 2>&1
|
||||||
|
RET=$?
|
||||||
|
|
||||||
|
if [[ $RET -ne 0 ]]; then
|
||||||
|
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[*] Angular Build Succeeded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Copy the required files to the build output
|
||||||
|
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Step 3: Clean up
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.map
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.min*
|
||||||
|
rm -rf bundletmp
|
||||||
|
mv dist/$MODULENAME/bundles/ bundletmp
|
||||||
|
rm -rf dist/$MODULENAME/*
|
||||||
|
mv bundletmp/* dist/$MODULENAME/
|
||||||
|
rm -rf bundletmp
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
||||||
rm -rf $MODULENAME-$VERS.tar.gz
|
rm -rf $MODULENAME-$VERS.tar.gz
|
||||||
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
||||||
|
@ -37,6 +67,24 @@ if [[ $1 == "package" ]]; then
|
||||||
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
||||||
mv $MODULENAME-$VERS.tar.gz ../
|
mv $MODULENAME-$VERS.tar.gz ../
|
||||||
cd ../
|
cd ../
|
||||||
else
|
}
|
||||||
echo "[*] Skipping Packaging (Run ./build.sh package to generate)"
|
|
||||||
fi
|
copy_to_device() {
|
||||||
|
echo "[*] Copying module to WiFi Pineapple via SCP"
|
||||||
|
scp -r dist/$MODULENAME root@172.16.42.1:/pineapple/modules
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_workspace
|
||||||
|
build_module
|
||||||
|
|
||||||
|
if [[ $1 == "package" ]]; then
|
||||||
|
package
|
||||||
|
elif [[ $1 == "copy" ]]; then
|
||||||
|
copy_to_device
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Success!"
|
||||||
|
}
|
||||||
|
|
||||||
|
main $1
|
108
cabinet/build.sh
108
cabinet/build.sh
|
@ -1,35 +1,65 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Step 1: Build the Angular module
|
|
||||||
ng build --prod > /dev/null 2>&1
|
|
||||||
RET=$?
|
|
||||||
|
|
||||||
if [[ $RET -ne 0 ]]; then
|
|
||||||
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "[*] Angular Build Succeeded"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Copy the required files to the build output
|
|
||||||
MODULENAME=$(basename $PWD)
|
MODULENAME=$(basename $PWD)
|
||||||
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
|
|
||||||
# Step 3: Clean up
|
check_workspace() {
|
||||||
rm -rf dist/$MODULENAME/bundles/*.map
|
if [[ ! -d "node_modules" ]]; then
|
||||||
rm -rf dist/$MODULENAME/bundles/*.min*
|
while true; do
|
||||||
rm -rf bundletmp
|
read -p "[!!] The Angular workspace has not been prepared. Would you like to do it now? [Y\n] " yn
|
||||||
mv dist/$MODULENAME/bundles/ bundletmp
|
case $yn in
|
||||||
rm -rf dist/$MODULENAME/*
|
[Yy]* ) prepare_workspace; break;;
|
||||||
mv bundletmp/* dist/$MODULENAME/
|
[Nn]* ) exit 1;;
|
||||||
rm -rf bundletmp
|
* ) prepare_workspace; break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Step 4: Package (Optional)
|
prepare_workspace() {
|
||||||
if [[ $1 == "package" ]]; then
|
echo "[*] Preparing the Angular workspace."
|
||||||
|
|
||||||
|
if ! command -v npm &> /dev/null; then
|
||||||
|
echo "[!] NPM does not appear to be installed on this system. Failed to create workspace."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! npm install &> /dev/null; then
|
||||||
|
echo "[!] Failed to prepare workspace. Run npm install to see why."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Prepared the Angular workspace successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
build_module() {
|
||||||
|
ng build --prod > /dev/null 2>&1
|
||||||
|
RET=$?
|
||||||
|
|
||||||
|
if [[ $RET -ne 0 ]]; then
|
||||||
|
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[*] Angular Build Succeeded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Copy the required files to the build output
|
||||||
|
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Step 3: Clean up
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.map
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.min*
|
||||||
|
rm -rf bundletmp
|
||||||
|
mv dist/$MODULENAME/bundles/ bundletmp
|
||||||
|
rm -rf dist/$MODULENAME/*
|
||||||
|
mv bundletmp/* dist/$MODULENAME/
|
||||||
|
rm -rf bundletmp
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
||||||
rm -rf $MODULENAME-$VERS.tar.gz
|
rm -rf $MODULENAME-$VERS.tar.gz
|
||||||
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
||||||
|
@ -37,6 +67,24 @@ if [[ $1 == "package" ]]; then
|
||||||
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
||||||
mv $MODULENAME-$VERS.tar.gz ../
|
mv $MODULENAME-$VERS.tar.gz ../
|
||||||
cd ../
|
cd ../
|
||||||
else
|
}
|
||||||
echo "[*] Skipping Packaging (Run ./build.sh package to generate)"
|
|
||||||
fi
|
copy_to_device() {
|
||||||
|
echo "[*] Copying module to WiFi Pineapple via SCP"
|
||||||
|
scp -r dist/$MODULENAME root@172.16.42.1:/pineapple/modules
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_workspace
|
||||||
|
build_module
|
||||||
|
|
||||||
|
if [[ $1 == "package" ]]; then
|
||||||
|
package
|
||||||
|
elif [[ $1 == "copy" ]]; then
|
||||||
|
copy_to_device
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Success!"
|
||||||
|
}
|
||||||
|
|
||||||
|
main $1
|
|
@ -20,7 +20,7 @@ print_banner() {
|
||||||
echo " \ /\ / | | | | | | | | | | | | __/ (_| | |_) | |_) | | __/ "
|
echo " \ /\ / | | | | | | | | | | | | __/ (_| | |_) | |_) | | __/ "
|
||||||
echo " \/ \/ |_|_| |_| |_| |_|_| |_|\___|\__,_| .__/| .__/|_|\___| Mark 7"
|
echo " \/ \/ |_|_| |_| |_| |_|_| |_|\___|\__,_| .__/| .__/|_|\___| Mark 7"
|
||||||
echo " Module Creation Helper | | | | "
|
echo " Module Creation Helper | | | | "
|
||||||
echo " Version 1.0 |_| |_| "
|
echo " Version 1.1 |_| |_| "
|
||||||
echo " "
|
echo " "
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,65 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Step 1: Build the Angular module
|
|
||||||
ng build --prod > /dev/null 2>&1
|
|
||||||
RET=$?
|
|
||||||
|
|
||||||
if [[ $RET -ne 0 ]]; then
|
|
||||||
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "[*] Angular Build Succeeded"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Copy the required files to the build output
|
|
||||||
MODULENAME=$(basename $PWD)
|
MODULENAME=$(basename $PWD)
|
||||||
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
|
|
||||||
# Step 3: Clean up
|
check_workspace() {
|
||||||
rm -rf dist/$MODULENAME/bundles/*.map
|
if [[ ! -d "node_modules" ]]; then
|
||||||
rm -rf dist/$MODULENAME/bundles/*.min*
|
while true; do
|
||||||
rm -rf bundletmp
|
read -p "[!!] The Angular workspace has not been prepared. Would you like to do it now? [Y\n] " yn
|
||||||
mv dist/$MODULENAME/bundles/ bundletmp
|
case $yn in
|
||||||
rm -rf dist/$MODULENAME/*
|
[Yy]* ) prepare_workspace; break;;
|
||||||
mv bundletmp/* dist/$MODULENAME/
|
[Nn]* ) exit 1;;
|
||||||
rm -rf bundletmp
|
* ) prepare_workspace; break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Step 4: Package (Optional)
|
prepare_workspace() {
|
||||||
if [[ $1 == "package" ]]; then
|
echo "[*] Preparing the Angular workspace."
|
||||||
|
|
||||||
|
if ! command -v npm &> /dev/null; then
|
||||||
|
echo "[!] NPM does not appear to be installed on this system. Failed to create workspace."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! npm install &> /dev/null; then
|
||||||
|
echo "[!] Failed to prepare workspace. Run npm install to see why."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Prepared the Angular workspace successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
build_module() {
|
||||||
|
ng build --prod > /dev/null 2>&1
|
||||||
|
RET=$?
|
||||||
|
|
||||||
|
if [[ $RET -ne 0 ]]; then
|
||||||
|
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[*] Angular Build Succeeded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Copy the required files to the build output
|
||||||
|
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Step 3: Clean up
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.map
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.min*
|
||||||
|
rm -rf bundletmp
|
||||||
|
mv dist/$MODULENAME/bundles/ bundletmp
|
||||||
|
rm -rf dist/$MODULENAME/*
|
||||||
|
mv bundletmp/* dist/$MODULENAME/
|
||||||
|
rm -rf bundletmp
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
||||||
rm -rf $MODULENAME-$VERS.tar.gz
|
rm -rf $MODULENAME-$VERS.tar.gz
|
||||||
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
||||||
|
@ -37,6 +67,24 @@ if [[ $1 == "package" ]]; then
|
||||||
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
||||||
mv $MODULENAME-$VERS.tar.gz ../
|
mv $MODULENAME-$VERS.tar.gz ../
|
||||||
cd ../
|
cd ../
|
||||||
else
|
}
|
||||||
echo "[*] Skipping Packaging (Run ./build.sh package to generate)"
|
|
||||||
fi
|
copy_to_device() {
|
||||||
|
echo "[*] Copying module to WiFi Pineapple via SCP"
|
||||||
|
scp -r dist/$MODULENAME root@172.16.42.1:/pineapple/modules
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_workspace
|
||||||
|
build_module
|
||||||
|
|
||||||
|
if [[ $1 == "package" ]]; then
|
||||||
|
package
|
||||||
|
elif [[ $1 == "copy" ]]; then
|
||||||
|
copy_to_device
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Success!"
|
||||||
|
}
|
||||||
|
|
||||||
|
main $1
|
108
httpeek/build.sh
108
httpeek/build.sh
|
@ -1,35 +1,65 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Step 1: Build the Angular module
|
|
||||||
ng build --prod > /dev/null 2>&1
|
|
||||||
RET=$?
|
|
||||||
|
|
||||||
if [[ $RET -ne 0 ]]; then
|
|
||||||
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "[*] Angular Build Succeeded"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Copy the required files to the build output
|
|
||||||
MODULENAME=$(basename $PWD)
|
MODULENAME=$(basename $PWD)
|
||||||
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
|
|
||||||
# Step 3: Clean up
|
check_workspace() {
|
||||||
rm -rf dist/$MODULENAME/bundles/*.map
|
if [[ ! -d "node_modules" ]]; then
|
||||||
rm -rf dist/$MODULENAME/bundles/*.min*
|
while true; do
|
||||||
rm -rf bundletmp
|
read -p "[!!] The Angular workspace has not been prepared. Would you like to do it now? [Y\n] " yn
|
||||||
mv dist/$MODULENAME/bundles/ bundletmp
|
case $yn in
|
||||||
rm -rf dist/$MODULENAME/*
|
[Yy]* ) prepare_workspace; break;;
|
||||||
mv bundletmp/* dist/$MODULENAME/
|
[Nn]* ) exit 1;;
|
||||||
rm -rf bundletmp
|
* ) prepare_workspace; break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Step 4: Package (Optional)
|
prepare_workspace() {
|
||||||
if [[ $1 == "package" ]]; then
|
echo "[*] Preparing the Angular workspace."
|
||||||
|
|
||||||
|
if ! command -v npm &> /dev/null; then
|
||||||
|
echo "[!] NPM does not appear to be installed on this system. Failed to create workspace."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! npm install &> /dev/null; then
|
||||||
|
echo "[!] Failed to prepare workspace. Run npm install to see why."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Prepared the Angular workspace successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
build_module() {
|
||||||
|
ng build --prod > /dev/null 2>&1
|
||||||
|
RET=$?
|
||||||
|
|
||||||
|
if [[ $RET -ne 0 ]]; then
|
||||||
|
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[*] Angular Build Succeeded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Copy the required files to the build output
|
||||||
|
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Step 3: Clean up
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.map
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.min*
|
||||||
|
rm -rf bundletmp
|
||||||
|
mv dist/$MODULENAME/bundles/ bundletmp
|
||||||
|
rm -rf dist/$MODULENAME/*
|
||||||
|
mv bundletmp/* dist/$MODULENAME/
|
||||||
|
rm -rf bundletmp
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
||||||
rm -rf $MODULENAME-$VERS.tar.gz
|
rm -rf $MODULENAME-$VERS.tar.gz
|
||||||
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
||||||
|
@ -37,6 +67,24 @@ if [[ $1 == "package" ]]; then
|
||||||
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
||||||
mv $MODULENAME-$VERS.tar.gz ../
|
mv $MODULENAME-$VERS.tar.gz ../
|
||||||
cd ../
|
cd ../
|
||||||
else
|
}
|
||||||
echo "[*] Skipping Packaging (Run ./build.sh package to generate)"
|
|
||||||
fi
|
copy_to_device() {
|
||||||
|
echo "[*] Copying module to WiFi Pineapple via SCP"
|
||||||
|
scp -r dist/$MODULENAME root@172.16.42.1:/pineapple/modules
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_workspace
|
||||||
|
build_module
|
||||||
|
|
||||||
|
if [[ $1 == "package" ]]; then
|
||||||
|
package
|
||||||
|
elif [[ $1 == "copy" ]]; then
|
||||||
|
copy_to_device
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Success!"
|
||||||
|
}
|
||||||
|
|
||||||
|
main $1
|
108
mdk4/build.sh
108
mdk4/build.sh
|
@ -1,35 +1,65 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Step 1: Build the Angular module
|
|
||||||
ng build --prod > /dev/null 2>&1
|
|
||||||
RET=$?
|
|
||||||
|
|
||||||
if [[ $RET -ne 0 ]]; then
|
|
||||||
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "[*] Angular Build Succeeded"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Copy the required files to the build output
|
|
||||||
MODULENAME=$(basename $PWD)
|
MODULENAME=$(basename $PWD)
|
||||||
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
|
|
||||||
# Step 3: Clean up
|
check_workspace() {
|
||||||
rm -rf dist/$MODULENAME/bundles/*.map
|
if [[ ! -d "node_modules" ]]; then
|
||||||
rm -rf dist/$MODULENAME/bundles/*.min*
|
while true; do
|
||||||
rm -rf bundletmp
|
read -p "[!!] The Angular workspace has not been prepared. Would you like to do it now? [Y\n] " yn
|
||||||
mv dist/$MODULENAME/bundles/ bundletmp
|
case $yn in
|
||||||
rm -rf dist/$MODULENAME/*
|
[Yy]* ) prepare_workspace; break;;
|
||||||
mv bundletmp/* dist/$MODULENAME/
|
[Nn]* ) exit 1;;
|
||||||
rm -rf bundletmp
|
* ) prepare_workspace; break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Step 4: Package (Optional)
|
prepare_workspace() {
|
||||||
if [[ $1 == "package" ]]; then
|
echo "[*] Preparing the Angular workspace."
|
||||||
|
|
||||||
|
if ! command -v npm &> /dev/null; then
|
||||||
|
echo "[!] NPM does not appear to be installed on this system. Failed to create workspace."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! npm install &> /dev/null; then
|
||||||
|
echo "[!] Failed to prepare workspace. Run npm install to see why."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Prepared the Angular workspace successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
build_module() {
|
||||||
|
ng build --prod > /dev/null 2>&1
|
||||||
|
RET=$?
|
||||||
|
|
||||||
|
if [[ $RET -ne 0 ]]; then
|
||||||
|
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[*] Angular Build Succeeded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Copy the required files to the build output
|
||||||
|
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Step 3: Clean up
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.map
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.min*
|
||||||
|
rm -rf bundletmp
|
||||||
|
mv dist/$MODULENAME/bundles/ bundletmp
|
||||||
|
rm -rf dist/$MODULENAME/*
|
||||||
|
mv bundletmp/* dist/$MODULENAME/
|
||||||
|
rm -rf bundletmp
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
||||||
rm -rf $MODULENAME-$VERS.tar.gz
|
rm -rf $MODULENAME-$VERS.tar.gz
|
||||||
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
||||||
|
@ -37,6 +67,24 @@ if [[ $1 == "package" ]]; then
|
||||||
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
||||||
mv $MODULENAME-$VERS.tar.gz ../
|
mv $MODULENAME-$VERS.tar.gz ../
|
||||||
cd ../
|
cd ../
|
||||||
else
|
}
|
||||||
echo "[*] Skipping Packaging (Run ./build.sh package to generate)"
|
|
||||||
fi
|
copy_to_device() {
|
||||||
|
echo "[*] Copying module to WiFi Pineapple via SCP"
|
||||||
|
scp -r dist/$MODULENAME root@172.16.42.1:/pineapple/modules
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_workspace
|
||||||
|
build_module
|
||||||
|
|
||||||
|
if [[ $1 == "package" ]]; then
|
||||||
|
package
|
||||||
|
elif [[ $1 == "copy" ]]; then
|
||||||
|
copy_to_device
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Success!"
|
||||||
|
}
|
||||||
|
|
||||||
|
main $1
|
108
nmap/build.sh
108
nmap/build.sh
|
@ -1,35 +1,65 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Step 1: Build the Angular module
|
|
||||||
ng build --prod > /dev/null 2>&1
|
|
||||||
RET=$?
|
|
||||||
|
|
||||||
if [[ $RET -ne 0 ]]; then
|
|
||||||
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "[*] Angular Build Succeeded"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Copy the required files to the build output
|
|
||||||
MODULENAME=$(basename $PWD)
|
MODULENAME=$(basename $PWD)
|
||||||
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
|
|
||||||
# Step 3: Clean up
|
check_workspace() {
|
||||||
rm -rf dist/$MODULENAME/bundles/*.map
|
if [[ ! -d "node_modules" ]]; then
|
||||||
rm -rf dist/$MODULENAME/bundles/*.min*
|
while true; do
|
||||||
rm -rf bundletmp
|
read -p "[!!] The Angular workspace has not been prepared. Would you like to do it now? [Y\n] " yn
|
||||||
mv dist/$MODULENAME/bundles/ bundletmp
|
case $yn in
|
||||||
rm -rf dist/$MODULENAME/*
|
[Yy]* ) prepare_workspace; break;;
|
||||||
mv bundletmp/* dist/$MODULENAME/
|
[Nn]* ) exit 1;;
|
||||||
rm -rf bundletmp
|
* ) prepare_workspace; break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Step 4: Package (Optional)
|
prepare_workspace() {
|
||||||
if [[ $1 == "package" ]]; then
|
echo "[*] Preparing the Angular workspace."
|
||||||
|
|
||||||
|
if ! command -v npm &> /dev/null; then
|
||||||
|
echo "[!] NPM does not appear to be installed on this system. Failed to create workspace."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! npm install &> /dev/null; then
|
||||||
|
echo "[!] Failed to prepare workspace. Run npm install to see why."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Prepared the Angular workspace successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
build_module() {
|
||||||
|
ng build --prod > /dev/null 2>&1
|
||||||
|
RET=$?
|
||||||
|
|
||||||
|
if [[ $RET -ne 0 ]]; then
|
||||||
|
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[*] Angular Build Succeeded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Copy the required files to the build output
|
||||||
|
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Step 3: Clean up
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.map
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.min*
|
||||||
|
rm -rf bundletmp
|
||||||
|
mv dist/$MODULENAME/bundles/ bundletmp
|
||||||
|
rm -rf dist/$MODULENAME/*
|
||||||
|
mv bundletmp/* dist/$MODULENAME/
|
||||||
|
rm -rf bundletmp
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
||||||
rm -rf $MODULENAME-$VERS.tar.gz
|
rm -rf $MODULENAME-$VERS.tar.gz
|
||||||
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
||||||
|
@ -37,6 +67,24 @@ if [[ $1 == "package" ]]; then
|
||||||
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
||||||
mv $MODULENAME-$VERS.tar.gz ../
|
mv $MODULENAME-$VERS.tar.gz ../
|
||||||
cd ../
|
cd ../
|
||||||
else
|
}
|
||||||
echo "[*] Skipping Packaging (Run ./build.sh package to generate)"
|
|
||||||
fi
|
copy_to_device() {
|
||||||
|
echo "[*] Copying module to WiFi Pineapple via SCP"
|
||||||
|
scp -r dist/$MODULENAME root@172.16.42.1:/pineapple/modules
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_workspace
|
||||||
|
build_module
|
||||||
|
|
||||||
|
if [[ $1 == "package" ]]; then
|
||||||
|
package
|
||||||
|
elif [[ $1 == "copy" ]]; then
|
||||||
|
copy_to_device
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Success!"
|
||||||
|
}
|
||||||
|
|
||||||
|
main $1
|
108
tcpdump/build.sh
108
tcpdump/build.sh
|
@ -1,35 +1,65 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Step 1: Build the Angular module
|
|
||||||
ng build --prod > /dev/null 2>&1
|
|
||||||
RET=$?
|
|
||||||
|
|
||||||
if [[ $RET -ne 0 ]]; then
|
|
||||||
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "[*] Angular Build Succeeded"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Copy the required files to the build output
|
|
||||||
MODULENAME=$(basename $PWD)
|
MODULENAME=$(basename $PWD)
|
||||||
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
|
||||||
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
|
||||||
|
|
||||||
# Step 3: Clean up
|
check_workspace() {
|
||||||
rm -rf dist/$MODULENAME/bundles/*.map
|
if [[ ! -d "node_modules" ]]; then
|
||||||
rm -rf dist/$MODULENAME/bundles/*.min*
|
while true; do
|
||||||
rm -rf bundletmp
|
read -p "[!!] The Angular workspace has not been prepared. Would you like to do it now? [Y\n] " yn
|
||||||
mv dist/$MODULENAME/bundles/ bundletmp
|
case $yn in
|
||||||
rm -rf dist/$MODULENAME/*
|
[Yy]* ) prepare_workspace; break;;
|
||||||
mv bundletmp/* dist/$MODULENAME/
|
[Nn]* ) exit 1;;
|
||||||
rm -rf bundletmp
|
* ) prepare_workspace; break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Step 4: Package (Optional)
|
prepare_workspace() {
|
||||||
if [[ $1 == "package" ]]; then
|
echo "[*] Preparing the Angular workspace."
|
||||||
|
|
||||||
|
if ! command -v npm &> /dev/null; then
|
||||||
|
echo "[!] NPM does not appear to be installed on this system. Failed to create workspace."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! npm install &> /dev/null; then
|
||||||
|
echo "[!] Failed to prepare workspace. Run npm install to see why."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Prepared the Angular workspace successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
build_module() {
|
||||||
|
ng build --prod > /dev/null 2>&1
|
||||||
|
RET=$?
|
||||||
|
|
||||||
|
if [[ $RET -ne 0 ]]; then
|
||||||
|
echo "[!] Angular Build Failed: Run 'ng build --prod' to figure out why."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "[*] Angular Build Succeeded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Copy the required files to the build output
|
||||||
|
cp -r projects/$MODULENAME/src/module.svg dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.json dist/$MODULENAME/bundles/
|
||||||
|
cp -r projects/$MODULENAME/src/module.py dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/module.php dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
cp -r projects/$MODULENAME/src/assets/ dist/$MODULENAME/bundles/ > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Step 3: Clean up
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.map
|
||||||
|
rm -rf dist/$MODULENAME/bundles/*.min*
|
||||||
|
rm -rf bundletmp
|
||||||
|
mv dist/$MODULENAME/bundles/ bundletmp
|
||||||
|
rm -rf dist/$MODULENAME/*
|
||||||
|
mv bundletmp/* dist/$MODULENAME/
|
||||||
|
rm -rf bundletmp
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
VERS=$(cat dist/$MODULENAME/module.json | grep "version" | awk '{split($0, a, ": "); gsub("\"", "", a[2]); gsub(",", "", a[2]); print a[2]}')
|
||||||
rm -rf $MODULENAME-$VERS.tar.gz
|
rm -rf $MODULENAME-$VERS.tar.gz
|
||||||
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
echo "[*] Packaging $MODULENAME (Version $VERS)"
|
||||||
|
@ -37,6 +67,24 @@ if [[ $1 == "package" ]]; then
|
||||||
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
tar -pczf $MODULENAME-$VERS.tar.gz $MODULENAME
|
||||||
mv $MODULENAME-$VERS.tar.gz ../
|
mv $MODULENAME-$VERS.tar.gz ../
|
||||||
cd ../
|
cd ../
|
||||||
else
|
}
|
||||||
echo "[*] Skipping Packaging (Run ./build.sh package to generate)"
|
|
||||||
fi
|
copy_to_device() {
|
||||||
|
echo "[*] Copying module to WiFi Pineapple via SCP"
|
||||||
|
scp -r dist/$MODULENAME root@172.16.42.1:/pineapple/modules
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_workspace
|
||||||
|
build_module
|
||||||
|
|
||||||
|
if [[ $1 == "package" ]]; then
|
||||||
|
package
|
||||||
|
elif [[ $1 == "copy" ]]; then
|
||||||
|
copy_to_device
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Success!"
|
||||||
|
}
|
||||||
|
|
||||||
|
main $1
|
Loading…
Reference in New Issue