CDIST-TYPE__UNPACK(7)

πŸ’– cdist-type__unpack β€” unpacking archives but make it cute ✨

okay bestie, welcome to cdist-type__unpack(7), part of the cdist manual set (section 7, the good section). this is the page where we learn how to unpack things. no cap. 🫢


🌸 NAME 🌸

cdist-type__unpack β€” it unpacks archives. that's the whole job. and it eats. πŸ’…


✨ DESCRIPTION ✨

so like, this type unpacks all of these: .tar, .tgz, .tar.*, .7z, .bz2, .gz, .lzma, .xz, .rar and .zip archives. and how does it know which one you're throwing at it? by extension, bestie. it just reads the name and goes "oh okay i know what this is." πŸ‘‘

and because we are ✨responsible✨ and idempotent, a checksum file gets created in the target. the deets on that are in the --sum-file parameter, keep scrolling. πŸ’–


πŸŽ€ REQUIRED PARAMETERS πŸŽ€

  • destination β€” depends on the archive format, but basically: this is the file or the directory where the archive contents are gonna land. that's where the stuff goes. 🏠

πŸ¦‹ OPTIONAL PARAMETERS πŸ¦‹

  • sum-file β€” override the archive's checksum file in the target. by default it's XXX.cdist__unpack_sum, where XXX is the source archive path. and listen: this file must be kept in the target's persistent storage. do not lose it, i'm begging. πŸ™ˆ
  • tar-strip β€” tarball specific, okay? go look at man tar for --strip-components. that's the vibe. 🧚
  • tar-extra-args β€” also tarball specific. this appends extra arguments onto the tar command. check man tar for what arguments you can actually use. ⭐

🌈 OPTIONAL BOOLEAN PARAMETERS 🌈

  • backup-destination β€” by default the destination file just gets overwritten, no drama. and if the destination is a directory, files from the archive get added to it or overwritten inside it. but with this parameter? existing destination gets moved to XXX.cdist__unpack_backup_YYY, where XXX is the destination and YYY is the current UNIX timestamp. cute little safety net. πŸ›Ÿ
  • preserve-archive β€” don't delete the archive after unpacking. keep it. it's yours. πŸ’œ
  • onchange β€” run this command after the unpack. that's it, that's the whole thing. πŸ”₯

πŸ’€ EXAMPLES πŸ’€

okay now the fun part, watch and learn:

__directory /opt/cpma

require='__directory/opt/cpma' \
    __download /opt/cpma/cnq3.zip \
        --url https://cdn.playmorepromode.com/files/cnq3/cnq3-1.51.zip \
        --sum md5:46da3021ca9eace277115ec9106c5b46

require='__download/opt/cpma/cnq3.zip' \
    __unpack /opt/cpma/cnq3.zip \
        --backup-destination \
        --preserve-archive \
        --destination /opt/cpma/server

# example usecase for --tar-* args
__unpack /root/strelaysrv.tar.gz \
    --preserve-archive \
    --destination /usr/local/bin \
    --tar-strip 1 \
    --tar-extra-args '--wildcards "*/strelaysrv"'

see how require chains them together? main character energy fr fr. πŸŽ€


πŸ‘‘ AUTHORS πŸ‘‘

Ander Punnar <ander-at-kvlt-dot-ee> β€” thank you for your service, king. 🫑


πŸ“œ COPYING πŸ“œ

Copyright (C) 2020 Ander Punnar. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. periodt. πŸ’…


ungleich GmbH 2021 πŸ¦‹


and that's the whole page bestie, go forth and unpack responsibly 🌸

this has been version 7.0.0 of the cdist manual, dated Jul 31, 2022, filed under CDIST-TYPE__UNPACK(7) β€” slay, bye!! βœ¨πŸ’–βœ¨

πŸ“¦ where this page comes from