mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 00:00:13 -08:00
feat: Add comprehensive Plex recovery validation script
- Introduced `validate-plex-recovery.sh` for validating Plex database recovery. - Implemented checks for service status, database integrity, web interface accessibility, API functionality, and recent logs. - Added detailed recovery summary and next steps for users. fix: Improve Debian patching script for compatibility - Enhanced `debian-patches.sh` to securely download and execute bootstrap scripts. - Updated package mapping logic and ensured proper permissions for patched files. fix: Update Docker test scripts for better permission handling - Modified `run-docker-tests.sh` to set appropriate permissions on logs directory. - Ensured log files have correct permissions after test runs. fix: Enhance setup scripts for secure installations - Updated `setup.sh` to securely download and execute installation scripts for zoxide and nvm. - Improved error handling for failed downloads. fix: Refine startup script for log directory permissions - Adjusted `startup.sh` to set proper permissions for log directories and files. chore: Revamp update-containers.sh for better error handling and logging - Rewrote `update-containers.sh` to include detailed logging and error handling. - Added validation for Docker image names and improved overall script robustness.
This commit is contained in:
@@ -33,7 +33,8 @@ fi
|
||||
# Ensure the logs directory is writable
|
||||
if [ ! -w "$LOGS_DIR" ]; then
|
||||
echo -e "${YELLOW}Setting permissions on logs directory...${NC}"
|
||||
chmod -R 777 "$LOGS_DIR" || {
|
||||
chmod -R 755 "$LOGS_DIR" && \
|
||||
find "$LOGS_DIR" -type f -exec chmod 644 {} \; || {
|
||||
echo -e "${RED}Failed to set write permissions on logs directory!${NC}"
|
||||
exit 1
|
||||
}
|
||||
@@ -69,32 +70,33 @@ run_ubuntu_test() {
|
||||
# Create the logs directory if it doesn't exist
|
||||
local log_dir="$(pwd)/logs"
|
||||
mkdir -p "$log_dir" || true
|
||||
|
||||
|
||||
# Use sudo for chmod only if necessary
|
||||
if [ ! -w "$log_dir" ]; then
|
||||
echo -e "${YELLOW}Attempting to fix permissions with sudo...${NC}"
|
||||
sudo chmod -R 777 "$log_dir" 2>/dev/null || {
|
||||
sudo chmod -R 755 "$log_dir" 2>/dev/null && \
|
||||
sudo find "$log_dir" -type f -exec chmod 644 {} \; 2>/dev/null || {
|
||||
echo -e "${YELLOW}Could not change permissions with sudo, continuing anyway...${NC}"
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
echo -e "${YELLOW}Logs will be saved to: $log_dir${NC}"
|
||||
echo -e "${YELLOW}Building Ubuntu test container...${NC}"
|
||||
docker build --target ubuntu-test -t shell-test:ubuntu .
|
||||
|
||||
|
||||
echo -e "${GREEN}Running tests with package installation...${NC}"
|
||||
|
||||
|
||||
# Create a timestamp for this test run
|
||||
TEST_TIMESTAMP=$(date +"%Y%m%d-%H%M%S")
|
||||
echo -e "${YELLOW}Test run timestamp: $TEST_TIMESTAMP${NC}"
|
||||
|
||||
|
||||
# Run container with proper volume mount and add environment variable for timestamp
|
||||
docker run --rm -it \
|
||||
-e TEST_TIMESTAMP="$TEST_TIMESTAMP" \
|
||||
-e CONTAINER_TYPE="ubuntu" \
|
||||
-v "$log_dir:/logs:z" \
|
||||
shell-test:ubuntu
|
||||
|
||||
|
||||
# Check if logs were created
|
||||
if ls "$log_dir"/setup-test-*"$TEST_TIMESTAMP"* &>/dev/null 2>&1; then
|
||||
echo -e "${GREEN}Test logs successfully created in host directory${NC}"
|
||||
@@ -104,7 +106,7 @@ run_ubuntu_test() {
|
||||
echo -e "${YELLOW}Contents of log directory:${NC}"
|
||||
ls -la "$log_dir" || echo "Cannot list directory contents"
|
||||
fi
|
||||
|
||||
|
||||
echo -e "${BLUE}Test completed. Check logs in $log_dir directory${NC}"
|
||||
}
|
||||
|
||||
@@ -114,32 +116,33 @@ run_debian_test() {
|
||||
# Create the logs directory if it doesn't exist
|
||||
local log_dir="$(pwd)/logs"
|
||||
mkdir -p "$log_dir" || true
|
||||
|
||||
|
||||
# Use sudo for chmod only if necessary
|
||||
if [ ! -w "$log_dir" ]; then
|
||||
echo -e "${YELLOW}Attempting to fix permissions with sudo...${NC}"
|
||||
sudo chmod -R 777 "$log_dir" 2>/dev/null || {
|
||||
sudo chmod -R 755 "$log_dir" 2>/dev/null && \
|
||||
sudo find "$log_dir" -type f -exec chmod 644 {} \; 2>/dev/null || {
|
||||
echo -e "${YELLOW}Could not change permissions with sudo, continuing anyway...${NC}"
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
echo -e "${YELLOW}Logs will be saved to: $log_dir${NC}"
|
||||
echo -e "${YELLOW}Building Debian test container...${NC}"
|
||||
docker build --target debian-test -t shell-test:debian .
|
||||
|
||||
|
||||
echo -e "${GREEN}Running tests with package installation...${NC}"
|
||||
|
||||
|
||||
# Create a timestamp for this test run
|
||||
TEST_TIMESTAMP=$(date +"%Y%m%d-%H%M%S")
|
||||
echo -e "${YELLOW}Test run timestamp: $TEST_TIMESTAMP${NC}"
|
||||
|
||||
|
||||
# Run container with proper volume mount and add environment variable for timestamp
|
||||
docker run --rm -it \
|
||||
-e TEST_TIMESTAMP="$TEST_TIMESTAMP" \
|
||||
-e CONTAINER_TYPE="debian" \
|
||||
-v "$log_dir:/logs:z" \
|
||||
shell-test:debian
|
||||
|
||||
|
||||
# Check if logs were created
|
||||
if ls "$log_dir"/setup-test-*"$TEST_TIMESTAMP"* &>/dev/null 2>&1; then
|
||||
echo -e "${GREEN}Test logs successfully created in host directory${NC}"
|
||||
@@ -149,7 +152,7 @@ run_debian_test() {
|
||||
echo -e "${YELLOW}Contents of log directory:${NC}"
|
||||
ls -la "$log_dir" || echo "Cannot list directory contents"
|
||||
fi
|
||||
|
||||
|
||||
echo -e "${BLUE}Test completed. Check logs in $log_dir directory${NC}"
|
||||
}
|
||||
|
||||
@@ -158,7 +161,7 @@ run_full_test() {
|
||||
local distro=$1
|
||||
local tag_name=$(echo $distro | sed 's/:/-/g') # Replace colon with hyphen for tag
|
||||
echo -e "\n${BLUE}=== Running full bootstrap test in $distro container ===${NC}"
|
||||
|
||||
|
||||
# Create a Dockerfile for full test
|
||||
cat > Dockerfile.fulltest <<EOF
|
||||
FROM $distro
|
||||
@@ -198,7 +201,7 @@ EOF
|
||||
mkdir -p "$(pwd)/logs"
|
||||
docker build -f Dockerfile.fulltest -t shell-full-test:$tag_name .
|
||||
docker run --rm -it -v "$(pwd)/logs:/logs" shell-full-test:$tag_name
|
||||
|
||||
|
||||
# Clean up
|
||||
rm Dockerfile.fulltest
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user