Skip to content

Commit 3dadc71

Browse files
committed
fix: could not make symlink to snapshot script
1 parent 161eb93 commit 3dadc71

File tree

2 files changed

+74
-26
lines changed

2 files changed

+74
-26
lines changed

README.md

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@
33
[![Tests](https://github.com/BartSte/snapshot/actions/workflows/tests.yml/badge.svg)](https://github.com/BartSte/snapshot/actions/workflows/tests.yml)
44
[![Release](https://github.com/BartSte/snapshot/actions/workflows/release.yml/badge.svg)](https://github.com/BartSte/snapshot/actions/workflows/release.yml)
55

6-
> WORK IN PROGRESS!
6+
> WORK IN PROGRESS
77
> This project is still under development. The code is still experimental and
88
> is subject to change.
99
1010
## Table of Contents
1111

1212
- [Summary](#summary)
1313
- [Features](#features)
14-
- [Dependencies](#dependencies)
14+
- [Dependencies](#dependencies)
1515
- [Installation](#installation)
16-
- [Building](#building)
16+
- [Stand-alone tarball](#tarball-standalone)
17+
- [Linux](#linux)
18+
- [Build from source](#building)
1719
- [Linux](#linux)
1820
- [Raspberry Pi OS](#raspberry-pi-os)
1921
- [Usage](#usage)
2022
- [List the available cameras](#list-the-available-cameras)
2123
- [Display a video](#display-a-video)
2224
- [Record a video stream](#record-a-video-stream)
23-
- [Set the logging level](#set-the-logging-level)
2425
- [Using the configuration file](#using-the-configuration-file)
26+
- [Set the logging level](#set-the-logging-level)
2527
- [Development](#development)
2628
- [Build](#build)
2729
- [Test](#test)
@@ -36,9 +38,10 @@
3638
set of snapshots. This is useful when you want to make a time-lapse of a video.
3739
The application has a graphical user interface to view the video and a command
3840
line interface to configure the application. It can also be configured using a
39-
configuration file. The project is written in C++ and uses the [Qt6
40-
framework](https://www.qt.io/). For more information, run `snapshot --help`, or
41-
continue reading.
41+
configuration file. The project is written in C++ and uses
42+
[Qt6](https://www.qt.io/). It was tested on Ubuntu 22.04, Arch linux and also
43+
on Raspberry Pi OS. For more information, run `snapshot --help`, or continue
44+
reading.
4245

4346
### Features
4447

@@ -53,16 +56,18 @@ In short, `snapshot` contains the following features:
5356
- [x] Configure the application using a configuration file.
5457
- [x] Has a command line interface.
5558
- [ ] Runs on linux (including raspberry pi).
59+
- [x] Supports 64bit systems only.
5660

57-
## Dependencies
61+
### Dependencies
5862

59-
Ensure the following dependencies are installed:
63+
Snapshot relies on the following dependencies:
6064

61-
| Dependency | Version |
62-
| ------------------------------------------------------------- | -------- |
63-
| [Qt6](https://www.qt.io/download): base & multimedia (ffmpeg) | ≥ 6.6.0 |
64-
| [boost](https://www.boost.org/) | ≥ 1.83 |
65-
| [spdlog](https://github.com/gabime/spdlog) | ≥ 1.12.0 |
65+
| Dependency | Version |
66+
| ---------------------------------------------------- | ------- |
67+
| [Qt6](https://www.qt.io/download): base & multimedia | 6.6 |
68+
| [ffmpeg](https://ffmpeg.org/) | 6.1 |
69+
| [boost](https://www.boost.org/) | 1.74 |
70+
| [spdlog](https://github.com/gabime/spdlog) | 1.9 |
6671

6772
For building the project, the following dependencies are required:
6873

@@ -77,11 +82,50 @@ is installed using `cmake`.
7782
## Installation
7883

7984
The following sections explain how to install the project. You have two
80-
options: building the project from source, or using the pre built binaries. The
81-
easiest way is to use the pre built binaries.
85+
options: using the pre-built binaries. The easiest way is to use the pre-built
86+
binaries, i.e., the stand-alone tarball.
87+
88+
### Stand-alone tarball
89+
90+
Go to the [releases](https://github.com/BartSte/snapshot/releases) page and
91+
download the latest `tar.gz` file. Extract the file using the following
92+
command:
93+
94+
```bash
95+
tar -xvf snapshot-<version>-Linux.tar.gz
96+
```
97+
98+
This creates a `snapshot-<version>` directory with the following structure:
99+
100+
```bash
101+
snapshot-<version>
102+
├── bin/
103+
├── lib/
104+
└── snapshot
105+
```
106+
107+
where `bin` and `lib` are directories that you should not touch. On the other
108+
hand, the `snapshot` script is the one that you should use to interact with the
109+
application. For example:
110+
111+
```bash
112+
./snapshot-<version>/snapshot --help
113+
```
114+
115+
will print the help message. For convenience, you can place the
116+
`snapshot-<version>` folder anywhere you like, and create a symlink to the
117+
`snapshot` script in a directory that is in your `PATH`. For example:
118+
119+
```bash
120+
ln -s /path/to/snapshot-<version>/snapshot $HOME/bin/snapshot
121+
```
122+
123+
here it is assumed that the `$HOME/bin` directory is in your `PATH`.
82124

83125
### From source
84126

127+
- Needs an update!
128+
85129
The next steps explain how to build this project from source. The following
86130
sections explain how to build the project on different environments: Linux,
87131
Raspberry Pi OS. Despite the fact that Raspberry Pi OS is a linux distribution,
@@ -502,6 +546,7 @@ more information.
502546

503547
# TODO:
504548

549+
- [ ] Does the tarball work when you do a symlink to the bash script?
505550
- [ ] lib folder:
506551
- Check the list of shared libs in the docs. Filter out the libs that are not
507552
needed:

scripts/snapshot

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
#!/bin/sh
2-
# Copied from Qt's website at: https://doc.qt.io/qt-6/linux-deployment.html
1+
#!/bin/env bash
32

4-
appname=$(basename $0 | sed s,\.sh$,,)
3+
source=${BASH_SOURCE[0]}
4+
# resolve $source until the file is no longer a symlink
5+
while [ -L "$source" ]; do
6+
this_dir=$(cd -P "$(dirname "$source")" >/dev/null 2>&1 && pwd)
7+
source=$(readlink "$source")
58

6-
dirname=$(dirname $0)
7-
tmp="${dirname#?}"
9+
# if $source was a relative symlink, we need to resolve it relative to
10+
# the path where the symlink file was located
11+
[[ $source != /* ]] && source=$this_dir/$source
12+
done
13+
this_dir=$(cd -P "$(dirname "$source")" >/dev/null 2>&1 && pwd)
814

9-
if [ "${dirname%$tmp}" != "/" ]; then
10-
dirname=$PWD/$dirname
11-
fi
12-
LD_LIBRARY_PATH="$dirname/lib"
15+
LD_LIBRARY_PATH="$this_dir/lib"
1316
export LD_LIBRARY_PATH
14-
"$dirname/bin/$appname" "$@"
17+
"$this_dir/bin/snapshot" "$@"

0 commit comments

Comments
 (0)