I'd love help with this (or to find there's already a way to do this). I want to compile something. I don't want to make all the compile dependencies be marked manually installed, I just want them installed for now. Then, I want to autoremove after the compiling is done. But I don't want everything marked auto, just the packages I didn't already have marked manual.
So, it's this: apt install X Y Z, if any of X Y Z are already installed, do not alter their manual/auto flag, just do nothing, if any are not installed, install them but apt-mark auto so they aren't marked as manually installed.
I can't think of any clean way to do this without writing some complex script (which I'm not experienced with). I don't want to just install and remove because I don't want to lose anything that had been installed already, only the stuff that is newly installed…submitted by /u/wolftune