1- #! /bin/bash
1+ #! /usr/ bin/env bash
22
33set -e
44
5- function is_ubuntu() {
6- if [ -f /etc/os-release ]; then
7- grep -q " ubuntu" /etc/os-release
8- return $?
9- fi
10- return 1
11- }
12-
13- function is_debian() {
14- if [ -f /etc/os-release ]; then
15- grep -q " debian" /etc/os-release
16- return $?
17- fi
18- return 1
19- }
20-
21- function is_darwin() {
22- if [ " $( uname) " == " Darwin" ]; then
23- return 0
24- fi
25- return 1
26- }
27-
28- function is_arch() {
29- if [ -f /etc/os-release ]; then
30- grep -q " Arch Linux" /etc/os-release
31- return $?
32- fi
33- return 1
34- }
35-
36- if [ " $EUID " -eq 0 ]; then
37- export CUTEKIT_ELEVATOR=" "
38- elif [ -z " $CUTEKIT_ELEVATOR " ]; then
39- export CUTEKIT_ELEVATOR=" sudo"
40- fi
41-
42- if [ -z " $CUTEKIT_PYTHON " ]; then
43- if command -v python3.11 & > /dev/null; then
44- export CUTEKIT_PYTHON=" python3.11"
45- elif command -v python3.12 & > /dev/null; then
46- export CUTEKIT_PYTHON=" python3.12"
47- else
48- export CUTEKIT_PYTHON=" python3"
49- fi
50- fi
51-
525if [ " $EUID " -eq 0 ]; then
536 echo " Please do not run this script as root."
547
@@ -61,71 +14,5 @@ if [ "$EUID" -eq 0 ]; then
6114 fi
6215fi
6316
64- if [ " $CUTEKIT_NOVENV " == " 1" ]; then
65- echo " CUTEKIT_NOVENV is set, skipping virtual environment setup."
66- exec cutekit $@
67- fi
68-
69- if [ " $1 " == " tools" -a " $2 " == " nuke" ]; then
70- rm -rf .cutekit/tools .cutekit/venv .cutekit/tools-ready
71- exit 0
72- fi
73-
74- if [ ! -f .cutekit/tools-ready ]; then
75- if [ ! \( " $1 " == " tools" -a " $2 " == " setup" \) ]; then
76- echo " Tools not installed."
77- echo " This script will install the tooling required to build Paper Muncher into $PWD /.cutekit"
78-
79- read -p " Do you want to continue? [Y/n] " -n 1 -r
80- echo
81- if [[ ! $REPLY =~ ^[Yy]$ ]]; then
82- echo " Aborting."
83- exit 1
84- fi
85- else
86- echo " Installing tools..."
87- fi
88-
89- if is_ubuntu; then
90- echo " Detected Ubuntu, installing dependencies automatically..."
91- $CUTEKIT_ELEVATOR ./meta/scripts/setup-ubuntu.sh
92- elif is_debian; then
93- echo " Detected Debian, installing dependencies automatically..."
94- $CUTEKIT_ELEVATOR ./meta/scripts/setup-debian.sh
95- elif is_arch; then
96- echo " Detected Arch Linux, installing dependencies automatically..."
97- $CUTEKIT_ELEVATOR ./meta/scripts/setup-arch.sh
98- elif is_darwin; then
99- echo " Detected macOS, installing dependencies automatically..."
100- ./meta/scripts/setup-darwin.sh
101- fi
102-
103- mkdir -p .cutekit
104- if [ ! -d .cutekit/venv ]; then
105- echo " Setting up Python virtual environment..."
106- $CUTEKIT_PYTHON -m venv .cutekit/venv
107- fi
108- source .cutekit/venv/bin/activate
109-
110- echo " Installing Tools..."
111- pip3 install -r meta/plugins/requirements.txt
112-
113- touch .cutekit/tools-ready
114- echo " Done!"
115- fi
116-
117- if [ " $1 " == " tools" -a " $2 " == " setup" ]; then
118- echo " Tools already installed."
119- exit 0
120- fi
121-
122- if is_ubuntu; then
123- source ./meta/scripts/env-ubuntu.sh
124- elif is_darwin; then
125- source ./meta/scripts/env-darwin.sh
126- fi
127-
128- source .cutekit/venv/bin/activate
129- export PATH=" $PATH :.cutekit/venv/bin"
130-
131- cutekit $@
17+ source ./meta/scripts/setup-any.sh
18+ meta/scripts/cutekit-wrapper.py $@
0 commit comments