Skip to content

Instantly share code, notes, and snippets.

@slayerlab
Last active July 31, 2018 21:14
Show Gist options
  • Save slayerlab/6af37dfdef1c66d07d63ae4f5467c805 to your computer and use it in GitHub Desktop.
Save slayerlab/6af37dfdef1c66d07d63ae4f5467c805 to your computer and use it in GitHub Desktop.
Add this snippet at /usr/lib/rpm/macros
#=======
# this expanded %install scriptlet will create automatically if a directory not exists.
# So, you do not need to worry with rpm .spec file to create directory.
%__spec_install_pre %{___build_pre}\
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
mkdir -p `dirname "$RPM_BUILD_ROOT"`\
mkdir "$RPM_BUILD_ROOT"\
%{nil}
@slayerlab
Copy link
Author

slayerlab commented Jul 2, 2018

Warning:

Updates can overwrite your custom "/usr/lib/rpm/macros" file then I recommend you to check this inline spec if some errors occur at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment