-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_nuke
executable file
·187 lines (156 loc) · 5.73 KB
/
install_nuke
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/bash
# Detect the Linux distribution
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$NAME
elif type lsb_release >/dev/null 2>&1; then
OS=$(lsb_release -si | grep -v "No LSB modules are available." | head -n1)
else
OS=$(uname -s)
fi
# Function to install dependencies
echo "Installing Dependencies..."
case "$OS" in
"Ubuntu" | "Debian GNU/Linux")
sudo apt update
sudo apt install libglu1-mesa libxcb-xinerama0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0
;;
"Rocky Linux")
sudo dnf update
sudo dnf install mesa-libGLU libxcb libxkbcommon-x11 xcb-util-wm xcb-util-renderutil xcb-util-keysyms
;;
"Arch Linux")
sudo pacman -Syu
sudo pacman -S --needed libglvnd libxcb libxkbcommon-x11 xcb-util-wm xcb-util-renderutil xcb-util-keysyms
;;
*)
echo "Unsupported distribution: $OS"
exit 1
;;
esac
# Main script
echo "Foundry Nuke Installation Script"
echo "================================"
# Ask user to download Nuke
echo "Please download the Foundry Nuke installer from https://www.foundry.com/products/nuke/download to your ~/Downloads folder."
read -p "Press Enter when you have downloaded the installer."
# Find the Nuke installer
installer=$(find ~/Downloads -name "Nuke*-linux-*.tgz" -type f -print -quit)
if [ -z "$installer" ]; then
echo "Nuke installer not found in ~/Downloads. Please download it and try again."
exit 1
fi
# Extract the installer
echo "Extracting Nuke installer..."
tar -xzf "$installer" -C ~/Downloads
# Find the extracted directory
install_file=$(find ~/Downloads -name "Nuke*-linux-*.run" -type f -print -quit)
if [ -z "$install_file" ]; then
echo "Extracted Nuke directory not found. Installation failed."
exit 1
fi
# Run the installer
echo "Installing Nuke..."
read -p "Enter the path where Nuke should be installed (e.g., /opt/foundry/nuke): " nuke_path
# Check if the installation path requires sudo
if [[ "$nuke_path" == /opt/* || "$nuke_path" == /usr/* ]]; then
echo "The specified path may require sudo permissions."
echo "Running Nuke installer with sudo..."
sudo $install_file --accept-foundry-eula --prefix=$nuke_path
else
echo "Running Nuke installer..."
$install_file --accept-foundry-eula --prefix=$nuke_path
fi
# Check if installation was successful
if [ $? -eq 0 ]; then
echo "Nuke installation completed successfully."
else
echo "Nuke installation failed. Please check the error messages above."
exit 1
fi
# Extract Nuke version from the installer filename
nuke_version=$(echo "$installer" | grep -oP 'Nuke\K[0-9.v]+' | head -1)
# Extract major version (e.g., 15.1 from 15.1v2)
nuke_major_version=$(echo "$nuke_version" | grep -oP '^[0-9]+\.[0-9]+')
# Ask user if they want to install Steam
read -p "Do you to create a launch script (y/n): " launch_answer
if [[ $launch_answer == [Yy]* ]]; then
read -p "Enter the path where you want the launcher to be installed (e.g., /usr/local/bin): " launch_nuke_path
read -p "Are you running Nuke Non-Commercial? (y/n): " nuke_non_commercial
if [[ "$launch_nuke_path" == /opt/* || "$launch_nuke_path" == /usr/* ]]; then
sudoer="sudo"
else
sudoer=""
fi
if [[ $nuke_non_commercial == [Yy]* ]]; then
nc="--nc"
else
nc=""
fi
$sudoer tee -a $launch_nuke_path/nuke_launcher >/dev/null << EOF
#!/bin/bash
if [ "\$1" == "-h" ] || [ "\$1" == "--help" ]; then
echo "Usage:"
echo " ./nuke_launcher # Launch regular Nuke"
echo " ./nuke_launcher x # Launch NukeX"
echo " ./nuke_launcher studio # Launch Nuke Studio"
exit 0
fi
if [ "\$1" == "x" ]; then
$nuke_path/Nuke${nuke_version}/Nuke${nuke_major_version} --nukex $nc
elif [ "\$1" == "studio" ]; then
$nuke_path/Nuke${nuke_version}/Nuke${nuke_major_version} --studio $nc
else
$nuke_path/Nuke${nuke_version}/Nuke${nuke_major_version} $nc
fi
EOF
$sudoer chmod +x $launch_nuke_path/nuke_launcher
echo "Launch script created. Usage:"
echo " ./nuke_launcher # Launch regular Nuke"
echo " ./nuke_launcher x # Launch NukeX"
echo " ./nuke_launcher studio # Launch Nuke Studio"
else
echo "Launch script not created."
fi
# Add to PATH
read -p "Do you want to add the Nuke launcher to your PATH, in the .bashrc? (y/n): " add_to_path
if [ "$add_to_path" == "y" ]; then
echo 'export PATH=$PATH:$launch_nuke_path' >> ~/.bashrc
echo "Nuke launcher added to PATH. Please restart your terminal or run 'source ~/.bashrc'."
else
echo "add $launch_nuke_path/nuke_launcher to your 'PATH' enviroment variables"
fi
# Create application launcher
read -p "Do you want to create application launchers for Nuke, NukeX, and Nuke Studio? (y/n): " create_launcher
if [ "$create_launcher" == "y" ]; then
mkdir -p ~/.local/share/applications
# Nuke
cat << EOF > ~/.local/share/applications/nuke.desktop
[Desktop Entry]
Name=Nuke
Exec=$launch_nuke_path/nuke_launcher
Icon=$nuke_path/Nuke${nuke_version}/plugins/icons/NukeApp48.png
Type=Application
Categories=Graphics;
EOF
# NukeX
cat << EOF > ~/.local/share/applications/nukex.desktop
[Desktop Entry]
Name=NukeX
Exec=$launch_nuke_path/nuke_launcher x
Icon=$nuke_path/Nuke${nuke_version}/plugins/icons/NukeXApp48.png
Type=Application
Categories=Graphics;
EOF
# Nuke Studio
cat << EOF > ~/.local/share/applications/nukestudio.desktop
[Desktop Entry]
Name=Nuke Studio
Exec=$launch_nuke_path/nuke_launcher studio
Icon=$nuke_path/Nuke${nuke_version}/plugins/icons/NukeStudioApp48.png
Type=Application
Categories=Graphics;
EOF
echo "Application launchers created for Nuke, NukeX, and Nuke Studio. You should now see them in your applications menu."
fi
echo "Foundry Nuke installation completed!"