-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_installer.sh
77 lines (61 loc) · 2.09 KB
/
main_installer.sh
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
#!/bin/bash
# Color codes for formatting
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Quick Action and Destination Paths
SOURCE_QUICK_ACTION="compress_video.workflow"
DESTINATION_PATH="$HOME/Library/Services"
# Function to check and install Homebrew
install_homebrew() {
if ! command -v brew &> /dev/null; then
echo -e "${YELLOW}Homebrew not found. Installing Homebrew...${NC}"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH
echo -e "${GREEN}Adding Homebrew to PATH...${NC}"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$USER/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
}
# Function to install ffmpeg
install_ffmpeg() {
if ! command -v ffmpeg &> /dev/null; then
echo -e "${YELLOW}ffmpeg not found. Installing ffmpeg...${NC}"
brew install ffmpeg
else
echo -e "${GREEN}ffmpeg is already installed.${NC}"
fi
}
# Function to install Quick Action
install_quick_action() {
# Ensure destination directory exists
mkdir -p "$DESTINATION_PATH"
# Copy Quick Action
cp -R "$SOURCE_QUICK_ACTION" "$DESTINATION_PATH/"
# Set correct permissions
chmod -R 644 "$DESTINATION_PATH/$SOURCE_QUICK_ACTION.workflow"
echo -e "${GREEN}Quick Action installed successfully!${NC}"
}
# Main installation process
main() {
echo -e "${YELLOW}Starting Quick Action Installation...${NC}"
# Check for Xcode Command Line Tools
if ! xcode-select -p &> /dev/null; then
echo -e "${YELLOW}Installing Xcode Command Line Tools...${NC}"
xcode-select --install
# Wait for Xcode CLI tools to install
while ! xcode-select -p &> /dev/null; do
sleep 5
done
fi
# Install Homebrew
install_homebrew
# Install ffmpeg
install_ffmpeg
# Install Quick Action
install_quick_action
echo -e "${GREEN}Installation Complete! Your Quick Action is now ready to use.${NC}"
}
# Run the installation
main