Odroid c2 - turn on/off GPIO buttons

Hi. I’m new to this forum.
I’m writing to ask for help. I’ve installed succesfully dietpi on my odroid c2. I’m quite content with it, because i had errors installing LAMP on ubuntu 16.04 and here it works great. But I heard, that cutting power supply can damage my SD card, and that i should turn off SBC before cutting power. I can’t do it quite easily thorought SSH or VNC, so i woud like to make a physical power switch button. I tried this: https://magazine.odroid.com/article/odroid-c2-power-off-wake-using-simple-gpio-button/ but it does not work on dietpi. Does anybody know how can I do it?
I want to forgive you for my English, im not Englishman and I can’t use it perfectly.
Thank you in advance for help.

The boot.ini edit should be the same on DietPi, but the driver is required. I guess there is an APT package available in the repos (Meveric ones), perhaps you can search for it:
apt search meson64
apt search gpio

Perhaps you find a package that states to enable GPIO functionality. Sadly I have no Odroid here to check :wink:.