-
Notifications
You must be signed in to change notification settings - Fork 46
/
install-eggs-dev
executable file
·101 lines (87 loc) · 3.09 KB
/
install-eggs-dev
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
#!/bin/bash
# This script installs penguins-eggs on your system
# at /usr/lib/penguins-eggs/ and creates a symlink to /usr/bin/eggs
# it is intended for development purposes only
if command -v sudo >/dev/null 2>&1; then
SUDO='sudo'
else
SUDO='doas'
fi
clear
echo "installing penguins-eggs on /usr/lib/penguins-eggs/"
if [ ! -e /usr/bin/node ]; then
echo "node is not installed, please install nodejs"
exit 1
fi
# install modules
if [ ! -e node-modules ]; then
echo "installing nodejs modules"
rm -rf pnpm-lock.yaml dist
pnpm i
fi
# build
pnpm build
xdg-user-dirs-update --force
$SUDO cp scripts/eggs.bash /usr/share/bash-completion/completions/
$SUDO cp g4/* /usr/local/bin
$SUDO cp assets/eggs.png /usr/share/icons/
$SUDO mkdir -p /usr/share/man/man1
$SUDO cp manpages/doc/man/eggs.1.gz /usr/share/man/man1
DESKTOP_DIR=$(xdg-user-dir DESKTOP)
cp addons/eggs/adapt/applications/eggs-adapt.desktop "${DESKTOP_DIR}"
cp assets/penguins-eggs.desktop "${DESKTOP_DIR}"
for f in "$DESKTOP_DIR"/*.desktop; do chmod +x "$f"; gio set -t string "$f" metadata::xfce-exe-checksum "$(sha256sum "$f" | awk '{print $1}')"; done
# remove
$SUDO rm -rf /usr/lib/penguins-eggs/
$SUDO mkdir -p /usr/lib/penguins-eggs/
# install
$SUDO cp -rf addons /usr/lib/penguins-eggs/
$SUDO cp -rf assets /usr/lib/penguins-eggs/
$SUDO cp -rf bin /usr/lib/penguins-eggs/
$SUDO cp -rf conf /usr/lib/penguins-eggs/
$SUDO cp -rf dist /usr/lib/penguins-eggs/
$SUDO cp -rf dracut /usr/lib/penguins-eggs/
$SUDO cp -rf eui /usr/lib/penguins-eggs/
$SUDO cp -rf ipxe /usr/lib/penguins-eggs/
$SUDO cp -rf manpages /usr/lib/penguins-eggs/
$SUDO cp -rf mkinitcpio /usr/lib/penguins-eggs/
$SUDO cp -rf mkinitfs /usr/lib/penguins-eggs/
$SUDO cp -rf node_modules /usr/lib/penguins-eggs/
$SUDO cp -f .oclif.manifest.json /usr/lib/penguins-eggs/
$SUDO cp -f package.json /usr/lib/penguins-eggs/
$SUDO cp -f pnpm-lock.yaml /usr/lib/penguins-eggs/
$SUDO cp -f scripts /usr/lib/penguins-eggs/ -R
$SUDO cp -f syslinux /usr/lib/penguins-eggs/ -R
$SUDO ln -s /usr/bin/node /usr/lib/penguins-eggs/bin/node
# create /usr/lib/penguins-eggs/bin/eggs
cat << 'EOF' > /tmp/eggs
#!/usr/bin/env bash
set -e
echoerr() { echo "$@" 1>&2; }
get_script_dir () {
SOURCE="${BASH_SOURCE[0]}"
# While $SOURCE is a symlink, resolve it
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$( readlink "$SOURCE" )"
# If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo "$DIR"
}
DIR=$(get_script_dir)
export PB_UPDATE_INSTRUCTIONS="update with \"sudo apt update && sudo apt install pb\""
$DIR/node $DIR/run "$@"
EOF
$SUDO chmod +x /tmp/eggs
$SUDO mv /tmp/eggs /usr/lib/penguins-eggs/bin/eggs
$SUDO rm -f /usr/bin/eggs
$SUDO ln -s /usr/lib/penguins-eggs/bin/eggs /usr/bin/eggs
# create a symlink to /usr/bin/code
if [ -e /usr/bin/code-oss ]; then
if [ ! -e /usr/bin/code ]; then
$SUDO ln -s /usr/bin/code-oss /usr/bin/code
fi
fi
sudo eggs config -n