GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Medblock/utils.sh at main · baliola/Medblock

Expand file tree

/

utils.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
142 lines (124 loc) · 3.79 KB
/

utils.sh

Copy path

File metadata and controls

executable file
·
142 lines (124 loc) · 3.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
# colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # no color
# get root directory
ROOT_DIR=$(pwd)
SCRIPTS_DIR="${ROOT_DIR}/canister/scripts"
# handle command line arguments first
if [ "$1" = "--generate-declarations" ]; then
if [ "$2" = "--all" ]; then
# execute the script for all paths
if [ -f "${SCRIPTS_DIR}/declaration/generate_declaration.sh" ]; then
bash "${SCRIPTS_DIR}/declaration/generate_declaration.sh"
exit 0
else
echo -e "${RED}Error: declaration/generate_declaration.sh script not found${NC}"
exit 1
fi
fi
generate_declarations
exit 0
fi
# utility functions
generate_declarations() {
echo -e "${BLUE}Generating declarations...${NC}"
if [ "$1" = "--all" ]; then
# execute the script for all paths
if [ -f "${SCRIPTS_DIR}/declaration/generate_declaration.sh" ]; then
bash "${SCRIPTS_DIR}/declaration/generate_declaration.sh"
else
echo -e "${RED}Error: declaration/generate_declaration.sh script not found${NC}"
return 1
fi
else
# ask for environment as before
echo -e "${YELLOW}Select environment:${NC}"
echo -e "1) Development"
echo -e "2) Staging"
echo -e "3) Production"
read -r env_choice
case $env_choice in
1) env="dev" ;;
2) env="staging" ;;
3) env="prod" ;;
*)
echo -e "${RED}Invalid choice${NC}"
return 1
;;
esac
if [ -f "${SCRIPTS_DIR}/declaration/generate.sh" ]; then
bash "${SCRIPTS_DIR}/declaration/generate.sh" "$env"
else
echo -e "${RED}Error: declaration/generate.sh script not found${NC}"
return 1
fi
fi
}
reinstall_staging() {
echo -e "${BLUE}Reinstalling staging environment...${NC}"
# confirm action
echo -e "${YELLOW}This will reinstall the staging environment. Are you sure? (y/N)${NC}"
read -r confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo -e "${YELLOW}Operation cancelled${NC}"
return 0
fi
# execute the script
if [ -f "${SCRIPTS_DIR}/deployments/reinstall-staging.sh" ]; then
bash "${SCRIPTS_DIR}/deployments/reinstall-staging.sh"
else
echo -e "${RED}Error: deployments/reinstall-staging.sh script not found${NC}"
return 1
fi
}
upgrade_emr() {
echo -e "${BLUE}Upgrading EMR...${NC}"
# collect version information
echo -e "${YELLOW}Enter EMR version to upgrade to:${NC}"
read -r version
# confirm action
echo -e "${YELLOW}This will upgrade EMR to version $version. Are you sure? (y/N)${NC}"
read -r confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo -e "${YELLOW}Operation cancelled${NC}"
return 0
fi
# execute the script
if [ -f "${SCRIPTS_DIR}/upgrades/upgrade-emr.sh" ]; then
bash "${SCRIPTS_DIR}/upgrades/upgrade-emr.sh" "$version"
else
echo -e "${RED}Error: upgrades/upgrade-emr.sh script not found${NC}"
return 1
fi
}
# print menu
print_menu() {
echo -e "\n${YELLOW}=== Medblock Utils Menu ===${NC}"
echo -e "${BLUE}1)${NC} Generate Declarations"
echo -e "${BLUE}2)${NC} Reinstall Staging"
echo -e "${BLUE}3)${NC} Upgrade EMR"
echo -e "${BLUE}q)${NC} Quit"
echo -e "\n${YELLOW}Choose an option:${NC} "
}
# main menu loop
while true; do
print_menu
read -r opt
case $opt in
1) generate_declarations ;;
2) reinstall_staging ;;
3) upgrade_emr ;;
q | Q)
echo -e "${GREEN}Goodbye!${NC}"
exit 0
;;
*) echo -e "${RED}Invalid option${NC}" ;;
esac
echo -e "\nPress any key to continue..."
read -n 1 -s -r
clear
done
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.