mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 11:15:24 +03:00
Use `test -L` rather than `test -f` for `post-install.sh`. (Note: `[ ]` is an alternate invocation of the `test` shell builtin.) `[ -f some_path ]`, for a symlink "dereferences" the symlink, meaning it checks if its target (or the ultimate target, in the case of a chain of symlinks) exists and is a real file. By coincidence, as this runs after we extract/install ppm from the deb or rpm, the symlink target exists and is a real file. However, if we changed the install path for our package manager, the target might not exist, and this step might fail. `[ -L some_path ]` instead checks for if the path exists and is a symlink. This is more correct -- it's more directly what we're trying to check. So we will use `-L` rather than `-f`.
20 lines
340 B
Bash
20 lines
340 B
Bash
#!/bin/sh
|
|
|
|
FILESOURCE='/opt/Pulsar/resources/pulsar.sh'
|
|
FILEDEST='/usr/bin/pulsar'
|
|
|
|
if [ -f "$FILEDEST" ]
|
|
then
|
|
rm "$FILEDEST"
|
|
fi
|
|
cp "$FILESOURCE" "$FILEDEST"
|
|
|
|
SYMLINK_TARGET='/opt/Pulsar/resources/app/ppm/bin/apm'
|
|
SYMLINK_PATH='/usr/bin/ppm'
|
|
|
|
if [ -L "$SYMLINK_PATH" ]
|
|
then
|
|
rm "$SYMLINK_PATH"
|
|
fi
|
|
ln -s "$SYMLINK_TARGET" "$SYMLINK_PATH"
|