diff --git a/pkg/macos/pkg-scripts/postinstall b/pkg/macos/pkg-scripts/postinstall index 3cc98edd1f68..85f44b5f0cdf 100755 --- a/pkg/macos/pkg-scripts/postinstall +++ b/pkg/macos/pkg-scripts/postinstall @@ -86,55 +86,107 @@ fi log "Symlink: Creating symlinks for salt..." ln -sf "$INSTALL_DIR/salt" "$SBIN_DIR/salt" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-api..." ln -sf "$INSTALL_DIR/salt-api" "$SBIN_DIR/salt-api" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-api" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-call..." ln -sf "$INSTALL_DIR/salt-call" "$SBIN_DIR/salt-call" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-call" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-cloud..." ln -sf "$INSTALL_DIR/salt-cloud" "$SBIN_DIR/salt-cloud" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-cloud" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-cp..." ln -sf "$INSTALL_DIR/salt-cp" "$SBIN_DIR/salt-cp" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-cp" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-key..." ln -sf "$INSTALL_DIR/salt-key" "$SBIN_DIR/salt-key" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-key" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-master..." ln -sf "$INSTALL_DIR/salt-master" "$SBIN_DIR/salt-master" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-master" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-minion..." ln -sf "$INSTALL_DIR/salt-minion" "$SBIN_DIR/salt-minion" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-minion" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-proxy..." ln -sf "$INSTALL_DIR/salt-proxy" "$SBIN_DIR/salt-proxy" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-proxy" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-run..." ln -sf "$INSTALL_DIR/salt-run" "$SBIN_DIR/salt-run" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-run" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for spm..." ln -sf "$INSTALL_DIR/spm" "$SBIN_DIR/spm" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-spm" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-ssh..." ln -sf "$INSTALL_DIR/salt-ssh" "$SBIN_DIR/salt-ssh" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-ssh" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi log "Symlink: Creating symlinks for salt-syndic..." ln -sf "$INSTALL_DIR/salt-syndic" "$SBIN_DIR/salt-syndic" -log "Symlink: Created Successfully" +if [ -f "$SBIN_DIR/salt-syndic" ]; then + log "Symlink: Created Successfully" +else + log "Symlink: Failed to create symlink" +fi #------------------------------------------------------------------------------- # Add salt to paths.d diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index b7fa262fd53b..65a771f82cd9 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -29,7 +29,7 @@ def test_salt_version(version, install_salt): actual.append(actual_ver[0]) actual.append(actual_ver_salt_stripped) else: - pytest.skip("Not testing a non-release build artifact, do not run") + pytest.skip("We don't run this test on release builds") expected = ["salt", version] assert actual == expected @@ -128,7 +128,6 @@ def test_compare_versions(binary, install_salt): @pytest.mark.parametrize( "symlink", [ - # We can't create a salt symlink because there is a salt directory "salt", "salt-api", "salt-call", @@ -149,6 +148,8 @@ def test_symlinks_created(version, symlink, install_salt): Test symlinks created """ ret = install_salt.proc.run(pathlib.Path("/usr/local/sbin") / symlink, "--version") + install_log_file = pathlib.Path("/tmp") / "postinstall.txt" + install_log_content = install_log_file.read_text() ret.stdout.matcher.fnmatch_lines([f"*{version}*"])