0

I'm using an interactive pre-installation bash script in a CentOS-7 kickstart image. I was trying to use "trap" to catch user Ctrl+C (SIGINT) and run some code as follows:

trap_ctrl_c() {

 #Some code....

}

trap "trap_ctrl_c" SIGINT

While simulating the script (running it from the command line) works/traps perfectly, It seems like during the kickstart installation the signal is trapped by anaconda and ignored.

Any ideas?

  • Please edit your question and make it clear by formatting code part(use <Ctrl>+<K>) and remove unnecessary *s. Thank you – αғsнιη Dec 21 '14 at 11:58
  • The last command of trap_ctrl_c() is something like exit 0 or exit $?, right? – Konstantinos Dec 23 '14 at 0:03
  • @pidosaurus - No. the last command is some kind of assiment to a variable, afterwhich it should "return 0" natively. The thing is that trap_ctrl_c() is not triggered by pressing the ctrl+c within the %pre stage, unlike when running the script from the command line – linadif Dec 29 '14 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.