Maintaining muscle mass during and after a hernia operation

Does anyone have any ideas on how to maintain muscle mass and not gain too much bodyfat while not being able to lift for at least 6 weeks due to a hernia operation any advice regarding legal supplements or diet would be much appreciated cheers Jobe