This init.d script exists so one does not need to have a fixed size swap partition. Instead install without swap partition and then run this, with file size (re-)computed automatically to fit the current RAM size.
By default (and hence on installation) it creates swapfile twice as big as the present RAM amount with an upper limit of 2 GB.
It's also very helpful when included in SD card, USB stick or disk images which are distributed and run on many machines with different amount of RAM, e.g. different models of the Raspberry Pi or cloud images.