I am trying to do "unset" of an env variable from my rpm.spec file. which is not happening
Note that i am not exporting that env inside my rpm.spec.(i will do an export my self in cmd line)
$export user=akshatha
$export group=akshatha1
rpm.spec:
%postun
unset user
unset group
uninstalling the package:
$rpm -e (rpm_package)
check whether the value is unset or not(which is not unset):
$ echo $user
akshatha
$echo $group
akshatha1
You are mixing up what an rpm package is and what it can do.
Environment variables are set within a (bash, shell,...) Session. When you set variables and you start a new session, these variables are gone.
Rpm packages are supposed to install files at certain locations, to make permanent, system wide changes (like installing software). An rpm package, nor the installation of an rpm package is linked to your bash session (the installation will run in a separate session by the way).
You should not try to influence your environment variables with your rpm.
In the very unlikely case that you do need to export some kind of environment variable, then you should try to make it system wide available, for example declaring it in /etc/bashrc or something similar.