mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
installer (#11229)
Release Notes: - N/A --------- Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
d55b637b7e
commit
28bcc95468
@ -40,10 +40,15 @@ cargo build --release --target "${target_triple}" --package zed
|
||||
# Later, we probably want to do something like this: https://github.com/GabrielMajeri/separate-symbols
|
||||
strip "target/${target_triple}/release/Zed"
|
||||
|
||||
suffix=""
|
||||
if [ "$channel" != "stable" ]; then
|
||||
suffix="-$channel"
|
||||
fi
|
||||
|
||||
# Move everything that should end up in the final package
|
||||
# into a temp directory.
|
||||
temp_dir=$(mktemp -d)
|
||||
zed_dir="${temp_dir}/zed.app"
|
||||
zed_dir="${temp_dir}/zed$suffix.app"
|
||||
|
||||
# Binary
|
||||
mkdir -p "${zed_dir}/bin"
|
||||
@ -51,13 +56,18 @@ cp "target/${target_triple}/release/Zed" "${zed_dir}/zed"
|
||||
|
||||
# Icons
|
||||
mkdir -p "${zed_dir}/share/icons/hicolor/512x512/apps"
|
||||
cp "crates/zed/resources/app-icon-nightly.png" "${zed_dir}/share/icons/hicolor/512x512/apps/zed.png"
|
||||
cp "crates/zed/resources/app-icon$suffix.png" "${zed_dir}/share/icons/hicolor/512x512/apps/zed.png"
|
||||
mkdir -p "${zed_dir}/share/icons/hicolor/1024x1024/apps"
|
||||
cp "crates/zed/resources/app-icon-nightly@2x.png" "${zed_dir}/share/icons/hicolor/1024x1024/apps/zed.png"
|
||||
cp "crates/zed/resources/app-icon$suffix/share/icons/hicolor/1024x1024/apps/zed.png"
|
||||
|
||||
# .desktop
|
||||
mkdir -p "${zed_dir}/share/applications"
|
||||
cp "crates/zed/resources/zed.desktop" "${zed_dir}/share/applications/zed.desktop"
|
||||
cp "crates/zed/resources/zed$suffix.desktop" "${zed_dir}/share/applications/zed$suffix.desktop"
|
||||
if [[ "$channel" == "preview" ]]; then
|
||||
sed -i "s|Name=Zed|Name=Zed Preview|g" "${zed_dir}/share/applications/zed$suffix.desktop"
|
||||
elif [[ "$channel" == "nightly" ]]; then
|
||||
sed -i "s|Name=Zed|Name=Zed Nightly|g" "${zed_dir}/share/applications/zed$suffix.desktop"
|
||||
fi
|
||||
|
||||
# Licenses
|
||||
cp "assets/licenses.md" "${zed_dir}/licenses.md"
|
||||
@ -74,4 +84,4 @@ else
|
||||
fi
|
||||
|
||||
rm -rf "${archive}"
|
||||
tar -czvf $archive -C ${temp_dir} .
|
||||
tar -czvf $archive -C ${temp_dir} ${zed_dir}
|
||||
|
29
script/install.sh
Normal file → Executable file
29
script/install.sh
Normal file → Executable file
@ -43,32 +43,35 @@ main() {
|
||||
}
|
||||
|
||||
linux() {
|
||||
echo "Downloading zed.tar.gz"
|
||||
# curl "https://zed.dev/api/download/zed.tar.gz?platform=$platform&arch=$arch&channel=$channel" > "$temp/zed.tar.gz"
|
||||
|
||||
echo "Downloading Zed"
|
||||
curl "https://zed.dev/api/releases/$channel/latest/zed-linux-$arch.tar.gz" > "$temp/zed-linux-$arch.tar.gz"
|
||||
|
||||
mkdir -p "$HOME/.local/zed.app"
|
||||
suffix=""
|
||||
if [[ $channel != "stable" ]]; then
|
||||
suffix="-$channel"
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/.local/zed$suffix.app"
|
||||
tar -xzf "$temp/zed-linux-$arch.tar.gz" -C "$HOME/.local/"
|
||||
|
||||
# Set up xdg links so that app shows in the dock
|
||||
mkdir -p "$HOME/.local/bin" "$HOME/.local/share/applications"
|
||||
ln -sf ~/.local/zed.app/bin/zed ~/.local/bin/
|
||||
cp ~/.local/zed.app/share/applications/zed.desktop ~/.local/share/applications/
|
||||
sed -i "s|Icon=zed|Icon=$HOME/.local/zed.app/share/icons/hicolor/512x512/apps/zed.png|g" ~/.local/share/applications/zed.desktop
|
||||
sed -i "s|Exec=zed|Exec=$HOME/.local/zed.app/bin/zed|g" ~/.local/share/applications/zed.desktop
|
||||
ln -sf ~/.local/zed$suffix.app/bin/zed ~/.local/bin/
|
||||
cp ~/.local/zed$suffix.app/share/applications/zed$suffix.desktop ~/.local/share/applications/
|
||||
sed -i "s|Icon=zed|Icon=$HOME/.local/zed$suffix.app/share/icons/hicolor/512x512/apps/zed.png|g" ~/.local/share/applications/zed$suffix.desktop
|
||||
sed -i "s|Exec=zed|Exec=$HOME/.local/zed$suffix.app/bin/zed|g" ~/.local/share/applications/zed.desktop
|
||||
|
||||
if which zed >/dev/null 2>&1; then
|
||||
else
|
||||
if ! which zed >/dev/null 2>&1; then
|
||||
echo "To run zed from your terminal, you must add ~/.local/bin to your PATH"
|
||||
exit 1
|
||||
echo "Run:"
|
||||
echo " echo 'export PATH=\$HOME/.local/bin:\$PATH' >> ~/.bashrc"
|
||||
echo " source ~/.bashrc"
|
||||
fi
|
||||
|
||||
~/.local/bin/zed
|
||||
}
|
||||
|
||||
macos() {
|
||||
echo "Downloading Zed.dmg..."
|
||||
echo "Downloading Zed"
|
||||
curl "https://zed.dev/api/releases/$channel/latest/Zed-$arch.dmg" > "$temp/Zed-$arch.dmg"
|
||||
hdiutil attach -quiet "$temp/Zed-$arch.dmg" -mountpoint "$temp/mount"
|
||||
app="$(cd "$temp/mount/"; echo *.app)"
|
||||
|
@ -13,6 +13,8 @@ maysudo=$(command -v sudo || command -v doas || true)
|
||||
apt=$(command -v apt-get || true)
|
||||
if [[ -n $apt ]]; then
|
||||
deps=(
|
||||
gcc
|
||||
g++
|
||||
libasound2-dev
|
||||
libfontconfig-dev
|
||||
libwayland-dev
|
||||
|
Loading…
Reference in New Issue
Block a user