Add redis symlinks at the same place as the installed binaries
Related issue: https://github.com/valkey-io/valkey/issues/147
- Add a switch to the
src/Makefileto control whether or not to generate redis symlinks.
Run make install:
ls -al at /usr/local/bin:
make uninstall and ls -al:
- Added the relevant note to the README.md, this part has yet to be polished.
I think the approach makes sense, just some minor comments
Solved the language expression problem you suggested and the space problem in Makefile. Thanks for your help.
One more thing: The symlinks valkey-check-rdb -> valkey-server and valkey-check-aof -> valkey-server work by conditional code in server.c looking for the exec name, i.e. which symlink was used for starting it. Please also check that it works for redis-check-rdb etc.
Code in server.c:
/* Check if we need to start in redis-check-rdb/aof mode. We just execute
* the program main. However the program is part of the Redis executable
* so that we can easily execute an RDB check on loading errors. */
if (strstr(exec_name,"valkey-check-rdb") != NULL)
redis_check_rdb_main(argc,argv,NULL);
else if (strstr(exec_name,"valkey-check-aof") != NULL)
redis_check_aof_main(argc,argv);
One more thing: The symlinks
valkey-check-rdb -> valkey-serverandvalkey-check-aof -> valkey-serverwork by conditional code inserver.clooking for the exec name, i.e. which symlink was used for starting it. Please also check that it works forredis-check-rdbetc.Code in server.c:
/* Check if we need to start in redis-check-rdb/aof mode. We just execute * the program main. However the program is part of the Redis executable * so that we can easily execute an RDB check on loading errors. */ if (strstr(exec_name,"valkey-check-rdb") != NULL) redis_check_rdb_main(argc,argv,NULL); else if (strstr(exec_name,"valkey-check-aof") != NULL) redis_check_aof_main(argc,argv);
I will test it next.
My first PR that wasn't about typo. Thank you for your patience and help, have a nice day. 😀
Thanks @vitahlin! I edited the top comment to match what was finally implemented.
For me this change causes issues when using TLS. When I switch off symlinks for redis then installation fails cause it can't find libhiredis_ssl.a. Could this implementation be revisited?
@furai Yes, of course we can revise it. Why is libhiredis_ssl.a affected by this?
I haven't had time to dig into it. What I'm doing is pretty simple, e.g.:
make BUILD_TLS=yes USE_SYSTEMD=yes
make PREFIX=custom/usr USE_REDIS_SYMLINKS=no install
And then it fails with error because it can't find the aforementioned file. I was building from prepackaged version 7.2.5 available here on github.