mirror of
				https://github.com/pelican-eggs/eggs.git
				synced 2025-11-04 02:48:07 +00:00 
			
		
		
		
	added Update feature
Added startup type update to update minio version Color coded console output to make things more readable
This commit is contained in:
		
							parent
							
								
									ea0f1a54c5
								
							
						
					
					
						commit
						54c6dd3396
					
				@ -1,39 +1,51 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
##################################
 | 
					##################################
 | 
				
			||||||
echo Starting up....
 | 
					echo "$(tput setaf 2)Starting up...."
 | 
				
			||||||
echo "Startup Type: $STARTUP_TYPE"
 | 
					echo "Startup Type: $(tput setaf 2)$STARTUP_TYPE"
 | 
				
			||||||
if [ -f "keys/key.txt" ]; then
 | 
					if [ -f "keys/key.txt" ]; then
 | 
				
			||||||
echo "Key file detected..."
 | 
					echo "$(tput setaf 2)Key file detected..."
 | 
				
			||||||
export MINIO_ACCESS_KEY=`cat keys/key.txt`
 | 
					export MINIO_ACCESS_KEY=`cat keys/key.txt`
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
echo minioadmin > keys/key.txt
 | 
					echo minioadmin > keys/key.txt
 | 
				
			||||||
echo "No key file detected...Preparing First Time Boot"
 | 
					echo "$(tput setaf 3)No key file detected...Preparing First Time Boot"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [ -f "keys/secret.txt" ]; then
 | 
					if [ -f "keys/secret.txt" ]; then
 | 
				
			||||||
echo "Secret file detected..."
 | 
					echo "$(tput setaf 2)Secret file detected..."
 | 
				
			||||||
export MINIO_SECRET_KEY=`cat keys/secret.txt`
 | 
					export MINIO_SECRET_KEY=`cat keys/secret.txt`
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
echo minioadmin > keys/secret.txt
 | 
					echo minioadmin > keys/secret.txt
 | 
				
			||||||
echo "No secret file detected...Preparing First Time Boot"
 | 
					echo "No secret file detected...Preparing First Time Boot"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [ -f "keys/oldsecret.txt" ]; then
 | 
					if [ -f "keys/oldsecret.txt" ]; then
 | 
				
			||||||
echo "Old secret file detected..."
 | 
					echo "$(tput setaf 1)Old secret file detected..."
 | 
				
			||||||
export MINIO_SECRET_KEY_OLD=`cat keys/oldsecret.txt`
 | 
					export MINIO_SECRET_KEY_OLD=`cat keys/oldsecret.txt`
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [ -f "keys/oldkey.txt" ]; then
 | 
					if [ -f "keys/oldkey.txt" ]; then
 | 
				
			||||||
echo "Old key file detected..."
 | 
					echo "$(tput setaf 1)Old key file detected..."
 | 
				
			||||||
export MINIO_ACCESS_KEY_OLD=`cat keys/oldkey.txt`
 | 
					export MINIO_ACCESS_KEY_OLD=`cat keys/oldkey.txt`
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [ -f "keys/justrotated.txt" ]; then
 | 
					if [ -f "keys/justrotated.txt" ]; then
 | 
				
			||||||
echo "Previous key rotation detected...."
 | 
					echo "$(tput setaf 3)Previous key rotation detected...."
 | 
				
			||||||
echo "Clearing the Lanes...."
 | 
					echo "$(tput setaf 3)Clearing the Lanes...."
 | 
				
			||||||
unset MINIO_ACCESS_KEY_OLD
 | 
					unset MINIO_ACCESS_KEY_OLD
 | 
				
			||||||
unset MINIO_SECRET_KEY_OLD
 | 
					unset MINIO_SECRET_KEY_OLD
 | 
				
			||||||
 | 
					echo "$(tput setaf 2)Lanes Cleared!"
 | 
				
			||||||
STARTUP_TYPE=normal
 | 
					STARTUP_TYPE=normal
 | 
				
			||||||
rm keys/justrotated.txt
 | 
					rm keys/justrotated.txt
 | 
				
			||||||
rm keys/oldsecret.txt
 | 
					rm keys/oldsecret.txt
 | 
				
			||||||
rm keys/oldkey.txt
 | 
					rm keys/oldkey.txt
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##########################################
 | 
				
			||||||
 | 
					if [ -z "$STARTUP_TYPE" ] || [ "$STARTUP_TYPE" == "update" ]; then
 | 
				
			||||||
 | 
					echo "$(tput setaf 3)Performing update...."
 | 
				
			||||||
 | 
					echo "$(tput setaf 1)Removing old minio version"
 | 
				
			||||||
 | 
					rm minio
 | 
				
			||||||
 | 
					echo "$(tput setaf 3)Downloading new minio version"
 | 
				
			||||||
 | 
					wget https://dl.min.io/server/minio/release/linux-amd64/minio
 | 
				
			||||||
 | 
					chmod +x minio
 | 
				
			||||||
 | 
					echo "$(tput setaf 2)Update Complete"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
##########################################
 | 
					##########################################
 | 
				
			||||||
if [ -z "$STARTUP_TYPE" ] || [ "$STARTUP_TYPE" == "rotate" ]; then
 | 
					if [ -z "$STARTUP_TYPE" ] || [ "$STARTUP_TYPE" == "rotate" ]; then
 | 
				
			||||||
touch keys/justrotated.txt
 | 
					touch keys/justrotated.txt
 | 
				
			||||||
@ -45,12 +57,13 @@ export MINIO_ACCESS_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | h
 | 
				
			|||||||
echo $MINIO_ACCESS_KEY > keys/key.txt
 | 
					echo $MINIO_ACCESS_KEY > keys/key.txt
 | 
				
			||||||
export MINIO_SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
 | 
					export MINIO_SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
 | 
				
			||||||
echo $MINIO_SECRET_KEY > keys/secret.txt
 | 
					echo $MINIO_SECRET_KEY > keys/secret.txt
 | 
				
			||||||
echo Your New Access Key is: $MINIO_ACCESS_KEY
 | 
					echo "Your New Access Key is: $(tput setaf 2)$MINIO_ACCESS_KEY"
 | 
				
			||||||
echo Your New Secret Key is: $MINIO_SECRET_KEY
 | 
					echo "Your New Secret Key is: $(tput setaf 2)$MINIO_SECRET_KEY"
 | 
				
			||||||
echo Your Old Access Key is: $MINIO_ACCESS_KEY_OLD
 | 
					echo "Your Old Access Key is: $(tput setaf 3)$MINIO_ACCESS_KEY_OLD"
 | 
				
			||||||
echo Your Old Access Key is: $MINIO_SECRET_KEY_OLD
 | 
					echo "Your Old Access Key is: $(tput setaf 3)$MINIO_SECRET_KEY_OLD"
 | 
				
			||||||
echo Booting...
 | 
					echo "$(tput setaf 2)Booting..."
 | 
				
			||||||
./minio server data --address 0.0.0.0:$SERVER_PORT
 | 
					./minio server data --address 0.0.0.0:$SERVER_PORT
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
 | 
					echo "$(tput setaf 2)Booting..."
 | 
				
			||||||
./minio server data --address 0.0.0.0:$SERVER_PORT
 | 
					./minio server data --address 0.0.0.0:$SERVER_PORT
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user