Archives
This is a README.adoc file. The original repository is located here.
Archives
Branch:
ars
Fenrir ID:ars
Points:25
Your solution must be located at ars:
...
├─ ars
│ ├─ part-1.sh
│ ├─ part-2.sh
│ ├─ part-3.sh
│ └─ part-4.sh
└─ .git
Create archives (5 points)
Create a script part-1.sh which assembles files into an archive or compresses them.
- Archivation
-
./part-1.sh -a NAME FILES…— Creates an archiveNAMEwhich contains all the provided files. - Compression
-
./part-1.sh -z DIR FILES…— Compresses each file (gzip format) and puts the result into theDIRdirectory. Add.gzprefix to the resulting file name.
Format recognition (5 points)
When running tar xf ARCHIVE, it can automatically infer the compression format itself. Create a script part-2.sh which takes the path to a compressed archive and prints the used algorithm. Use must support these formats: gz, bz2, xz, zst.
[ command for archives (10 points)
Create a script part-3.sh which implements a L command (something like []):
L -e ARCHIVE J # ARCHIVE is empty
L ARCHIVE -sz 7 J # ARCHIVE has exactly 7 files
L ARCHIVE -has FILE J # ARCHIVE contains FILE
L and J are equivalents for [ and ]. The command must not print anything to the stdout, however the errors must be logged to the stderr.
The script’s behaviour is expected to be similar to the [: when the condition is true if L .. J; then .. fi must be executed, whereas it is false the if's body must be skipped.
Your script will be installed as L to the PATH during the tests and verified accordingly.
Install applications (5 points)
Application for Linux are often distributed as a .tar.gz files. Create a script part-4.sh which takes a path to an archive and installs the application it contains.
Those archives usually follow this structure:
APPNAME
├─ bin
│ ├─ ..
│ └─ APP
├─ lib
│ └─ ..
└─ ..
The APP is the binary which is executed to start the app.
The APPNAME during the tests is always app.
-
The application must be installed to the
/optdirectory -
The script is executed under non-privileged user. His password is pass through the
PASSenv variable -
The script will be
sourced: you may update the env so that the app can be invoked in terminal
Copyright
The project is licensed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
© 2026-present Iwan Kalinin <koefic.cien@gmail.com>