mirror of
https://github.com/MatthewL246/pretendo-docker.git
synced 2026-04-26 02:17:57 -05:00
Make the scripts less verbose
This commit is contained in:
parent
4285dbaac9
commit
95c3429e84
|
|
@ -24,7 +24,7 @@ cd "$git_base/repos/Inkay"
|
|||
|
||||
if [ "$should_reset" = false ]; then
|
||||
docker compose up -d mitmproxy-pretendo
|
||||
while ! docker compose exec mitmproxy-pretendo ls /home/mitmproxy/.mitmproxy/mitmproxy-ca-cert.pem >/dev/null; do
|
||||
while ! docker compose exec mitmproxy-pretendo ls /home/mitmproxy/.mitmproxy/mitmproxy-ca-cert.pem >/dev/null 2>&1; do
|
||||
info "Waiting for mitmproxy to generate a certificate..."
|
||||
sleep 1
|
||||
done
|
||||
|
|
|
|||
|
|
@ -10,6 +10,5 @@ if [ "$#" -lt 1 ]; then
|
|||
echo "Usage: $0 <PNID to give developer access>"
|
||||
exit 1
|
||||
fi
|
||||
info "Giving developer access to PNID $1..."
|
||||
|
||||
docker compose exec account node -e "$update_pnid_access_level_script" "$1"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ async function runAsync() {
|
|||
}
|
||||
|
||||
runAsync().then(() => {
|
||||
console.log("Done creating community.");
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
|
|
@ -80,17 +79,15 @@ async function createMainCommunity(
|
|||
olive_community_id: communityId,
|
||||
});
|
||||
|
||||
console.log("Saving new community:");
|
||||
console.log(newCommunity);
|
||||
console.log(`Saving new community "${newCommunity.name}"`);
|
||||
|
||||
await newCommunity.save();
|
||||
await uploadAssets(communityId, iconPath, bannerPath);
|
||||
}
|
||||
|
||||
async function uploadAssets(community_id, iconPath, bannerPath) {
|
||||
console.log("Uploading assets for community " + community_id);
|
||||
console.log(`Uploading assets for community ${community_id}`);
|
||||
if (iconPath) {
|
||||
console.log("Uploading icon from " + iconPath);
|
||||
const sizes = [32, 64, 128];
|
||||
const iconBuffer = await fs.readFile(iconPath);
|
||||
for (const size of sizes) {
|
||||
|
|
@ -111,12 +108,9 @@ async function uploadAssets(community_id, iconPath, bannerPath) {
|
|||
};
|
||||
await s3.putObject(uploadParams).promise();
|
||||
}
|
||||
} else {
|
||||
console.log("No icon path specified, skipping icon upload.");
|
||||
}
|
||||
|
||||
if (bannerPath) {
|
||||
console.log("Uploading banner from " + bannerPath);
|
||||
const consoles = ["WiiU", "3DS"];
|
||||
const bannerBuffer = await fs.readFile(bannerPath);
|
||||
for (const console of consoles) {
|
||||
|
|
@ -137,7 +131,5 @@ async function uploadAssets(community_id, iconPath, bannerPath) {
|
|||
};
|
||||
await s3.putObject(uploadParams).promise();
|
||||
}
|
||||
} else {
|
||||
console.log("No banner path specified, skipping banner upload.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ async function runAsync() {
|
|||
}
|
||||
|
||||
runAsync().then(() => {
|
||||
console.log("Done updating PNID access levels.");
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,18 +2,16 @@
|
|||
|
||||
set -eu
|
||||
|
||||
while ! mc alias set minio http://minio:9000 "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD"; do
|
||||
while ! mc alias set minio http://minio:9000 "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD" >/dev/null 2>&1; do
|
||||
echo "Waiting for MinIO to start..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
mc admin info minio
|
||||
|
||||
buckets="pn-cdn pn-boss"
|
||||
|
||||
# Create buckets and allow public access
|
||||
for bucket in $buckets; do
|
||||
if ! mc ls "minio/$bucket"; then
|
||||
if ! mc ls "minio/$bucket" >/dev/null 2>&1; then
|
||||
mc mb "minio/$bucket"
|
||||
mc anonymous set download "minio/$bucket"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ try {
|
|||
quit();
|
||||
}
|
||||
} catch (error) {
|
||||
print("Replica set not initiated. Proceeding with initiation...");
|
||||
print("Replica set not initiated. Proceeding...");
|
||||
}
|
||||
|
||||
// Initiate the replica set. We need to set up the members like this because, by
|
||||
|
|
@ -20,16 +20,3 @@ rs.initiate({
|
|||
},
|
||||
],
|
||||
});
|
||||
|
||||
// Wait for the replica set to initiate
|
||||
while (rs.status().hasOwnProperty("myState") && rs.status().myState != 1) {
|
||||
print("Waiting for replica set to initiate...");
|
||||
printjson(rs.status());
|
||||
sleep(1000);
|
||||
}
|
||||
|
||||
// Log replica set configuration
|
||||
print("Replica set configuration:");
|
||||
printjson(rs.conf());
|
||||
print("Replica set status:");
|
||||
printjson(rs.status());
|
||||
|
|
|
|||
|
|
@ -67,14 +67,12 @@ async function runAsync() {
|
|||
}
|
||||
|
||||
runAsync().then(() => {
|
||||
console.log("Done creating servers.");
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
async function resetServers() {
|
||||
console.log("Deleting all servers...");
|
||||
await Server.deleteMany({});
|
||||
console.log("Servers collection reset.");
|
||||
}
|
||||
|
||||
async function createNexServer(
|
||||
|
|
@ -112,8 +110,7 @@ async function createNexServer(
|
|||
aes_key: aes_key,
|
||||
});
|
||||
|
||||
console.log("Saving new nex server:");
|
||||
console.log(newServer);
|
||||
console.log(`Saving new nex server: ${newServer.service_name}:${newServer.access_mode}`);
|
||||
|
||||
await newServer.save();
|
||||
}
|
||||
|
|
@ -150,8 +147,7 @@ async function createServiceServer(
|
|||
aes_key: aes_key,
|
||||
});
|
||||
|
||||
console.log("Saving new service server:");
|
||||
console.log(newServer);
|
||||
console.log(`Saving new service server: ${newServer.service_name}:${newServer.access_mode}`);
|
||||
|
||||
await newServer.save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,12 @@ async function runAsync() {
|
|||
}
|
||||
|
||||
runAsync().then(() => {
|
||||
console.log("Done creating endpoints.");
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
async function resetEndpoints() {
|
||||
console.log("Deleting all endpoints...");
|
||||
await Endpoint.deleteMany({});
|
||||
console.log("Endpoint collection reset.");
|
||||
}
|
||||
|
||||
async function createEndpoint(status, host, api_host, portal_host, n3ds_host) {
|
||||
|
|
@ -43,8 +41,7 @@ async function createEndpoint(status, host, api_host, portal_host, n3ds_host) {
|
|||
n3ds_host: n3ds_host,
|
||||
});
|
||||
|
||||
console.log("Saving new endpoint:");
|
||||
console.log(newEndpoint);
|
||||
console.log(`Saving new endpoint: ${newEndpoint.server_access_level}`);
|
||||
|
||||
await newEndpoint.save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ git_base=$(git rev-parse --show-toplevel)
|
|||
. "$git_base/scripts/.function-lib.sh"
|
||||
|
||||
info "Resetting all submodules..."
|
||||
git submodule sync --recursive
|
||||
git submodule foreach --recursive "git reset --hard"
|
||||
git submodule update --init --recursive --checkout --force
|
||||
git submodule sync --recursive >/dev/null
|
||||
git submodule foreach --recursive "git reset --hard" >/dev/null
|
||||
git submodule update --init --recursive --checkout --force >/dev/null
|
||||
|
||||
info "Applying patches to submodules..."
|
||||
num_patches=0
|
||||
|
|
@ -19,7 +19,6 @@ for dir in "$git_base/patches/"*; do
|
|||
cd "$git_base/repos/$subdir"
|
||||
|
||||
for patch in "$git_base/patches/$subdir"/*; do
|
||||
echo "Applying patch $subdir/$(basename "$patch")..."
|
||||
git apply "$patch"
|
||||
git add .
|
||||
num_patches=$((num_patches + 1))
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ fi
|
|||
|
||||
docker compose up -d postgres
|
||||
|
||||
while ! docker compose exec postgres psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "\l"; do
|
||||
while ! docker compose exec postgres psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "\l" >/dev/null 2>&1; do
|
||||
echo "Waiting for PostgreSQL to start..."
|
||||
sleep 1
|
||||
done
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ fi
|
|||
if [ "$should_reset" = false ]; then
|
||||
docker compose up -d mitmproxy-pretendo
|
||||
|
||||
while ! docker compose exec mitmproxy-pretendo ls /home/mitmproxy/.mitmproxy/mitmproxy-ca-cert.pem >/dev/null; do
|
||||
while ! docker compose exec mitmproxy-pretendo ls /home/mitmproxy/.mitmproxy/mitmproxy-ca-cert.pem >/dev/null 2>&1; do
|
||||
info "Waiting for mitmproxy to generate a certificate..."
|
||||
sleep 1
|
||||
done
|
||||
|
|
|
|||
6
setup.sh
6
setup.sh
|
|
@ -8,7 +8,7 @@ check_git_repository() {
|
|||
echo "$(tput bold)$(tput setaf 1)Error: ${*}$(tput sgr0)" >&2
|
||||
}
|
||||
|
||||
if ! git --version; then
|
||||
if ! git --version >/dev/null; then
|
||||
error "Git is not installed. Please install it: https://git-scm.com/downloads/"
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -27,12 +27,12 @@ check_git_repository() {
|
|||
check_prerequisites() {
|
||||
prerequisites_failed=false
|
||||
prerequisites_warning=false
|
||||
if ! docker version; then
|
||||
if ! docker version >/dev/null; then
|
||||
error "Docker is not installed. Please install it: https://docs.docker.com/get-docker/"
|
||||
info "If you see a \"Permission denied while trying to connect to the Docker daemon\" error, you need to run this script with sudo."
|
||||
prerequisites_failed=true
|
||||
fi
|
||||
if ! docker compose version; then
|
||||
if ! docker compose version >/dev/null; then
|
||||
error "Docker Compose is not installed. Please install it: https://docs.docker.com/compose/install/"
|
||||
prerequisites_failed=true
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user