Created
December 11, 2019 23:10
-
-
Save keith-bennett-gbg/bd7651d6231e93470983093eac1fff62 to your computer and use it in GitHub Desktop.
Use cpack to install random data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CMAKE_MINIMUM_REQUIRED(VERSION 3.5) # not sure what the minimum actually is. this is locally installed. | |
PROJECT(example C) # C says to find C compilers. Ignore that. | |
# or from git or read from a file or whatever | |
SET(VERSION "1.0.0") | |
set(CPACK_PACKAGE_VERSION ${VERSION}) | |
set(CPACK_GENERATOR "RPM") | |
set(CPACK_PACKAGE_NAME "koti") | |
set(CPACK_PACKAGE_RELEASE 1) | |
set(CPACK_PACKAGE_CONTACT "inetknght <example@example.com>") | |
set(CPACK_PACKAGE_VENDOR "koti") | |
set(CPACK_PACKAGE_RELOCATABLE ON) # this tells the RPM to understand that it might not be installed at filesystem root | |
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") | |
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}") | |
include(CPack) | |
INSTALL(DIRECTORY payload/bin DESTINATION usr/bin) | |
INSTALL(DIRECTORY payload/conf DESTINATION etc) | |
INSTALL(DIRECTORY payload/data DESTINATION var) | |
INSTALL(DIRECTORY payload/elasticsearch DESTINATION opt/elasticsearch) | |
INSTALL(DIRECTORY payload/extensions DESTINATION opt/elasticsearch-extensions) # not sure where this goes | |
INSTALL(DIRECTORY payload/lib DESTINATION lib) | |
INSTALL(DIRECTORY payload/logs DESTINATION var/log) # maybe? | |
INSTALL(DIRECTORY payload/temp DESTINATION tmp) # wat | |
INSTALL(DIRECTORY payload/web DESTINATION opt/www) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir -p payload | |
$ for dir in bin conf data elasticsearch extensions lib logs temp web; do mkdir -p payload/${dir}; touch payload/${dir}/${dir}-file; done | |
$ touch payload/COPYING | |
$ tree | |
. | |
├── CMakeLists.txt | |
└── payload | |
├── bin | |
│ └── bin-file | |
├── conf | |
│ └── conf-file | |
├── COPYING | |
├── data | |
│ └── data-file | |
├── elasticsearch | |
│ └── elasticsearch-file | |
├── extensions | |
│ └── extensions-file | |
├── lib | |
│ └── lib-file | |
├── logs | |
│ └── logs-file | |
├── temp | |
│ └── temp-file | |
└── web | |
└── web-file | |
10 directories, 11 files | |
$ mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/prefix/path/for/install ../ && make -j$(nproc) && ctest && cpack && rpm -qlpv koti-1.0.0-1.x86_64.rpm --info | |
-- The C compiler identification is GNU 7.4.0 | |
-- Check for working C compiler: /usr/bin/cc | |
-- Check for working C compiler: /usr/bin/cc -- works | |
-- Detecting C compiler ABI info | |
-- Detecting C compiler ABI info - done | |
-- Detecting C compile features | |
-- Detecting C compile features - done | |
-- Configuring done | |
-- Generating done | |
-- Build files have been written to: /home/keithb/dev/mytest/cpack/build | |
********************************* | |
No test configuration file found! | |
********************************* | |
Usage | |
ctest [options] | |
CPack: Create package using RPM | |
CPack: Install projects | |
CPack: - Run preinstall target for: example | |
CPack: - Install project: example | |
CPack: Create package | |
-- CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=/home/keithb/dev/mytest/cpack/build/_CPack_Packages/Linux/RPM | |
CPackRPM: Will use GENERATED spec file: /home/keithb/dev/mytest/cpack/build/_CPack_Packages/Linux/RPM/SPECS/koti.spec | |
CPack: - package: /home/keithb/dev/mytest/cpack/build/koti-1.0.0-1.x86_64.rpm generated. | |
Name : koti | |
Version : 1.0.0 | |
Release : 1 | |
Architecture: x86_64 | |
Install Date: (not installed) | |
Group : unknown | |
Size : 0 | |
License : unknown | |
Signature : (none) | |
Source RPM : koti-1.0.0-1.src.rpm | |
Build Date : Wed 11 Dec 2019 05:07:18 PM CST | |
Build Host : keithb-pc | |
Relocations : /prefix/path/for/install | |
Vendor : Knight of the Internet | |
Summary : example built using CMake | |
Description : | |
DESCRIPTION | |
=========== | |
This is an installer created using CPack (https://cmake.org). No additional installation instructions provided. | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/etc | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/etc/conf | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/etc/conf/conf-file | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/lib | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/lib/lib | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/lib/lib/lib-file | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/opt | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/opt/elasticsearch | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/opt/elasticsearch-extensions | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/opt/elasticsearch-extensions/extensions | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/opt/elasticsearch-extensions/extensions/extensions-file | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/opt/elasticsearch/elasticsearch | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/opt/elasticsearch/elasticsearch/elasticsearch-file | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/opt/www | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/opt/www/web | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/opt/www/web/web-file | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/tmp | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/tmp/temp | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/tmp/temp/temp-file | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/usr | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/usr/bin | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/usr/bin/bin | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/usr/bin/bin/bin-file | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/var | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/var/data | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/var/data/data-file | |
drwxrwxr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/var/log | |
drwxr-xr-x 2 root root 0 Dec 11 17:07 /prefix/path/for/install/var/log/logs | |
-rw-r--r-- 1 root root 0 Dec 11 16:53 /prefix/path/for/install/var/log/logs/logs-file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment