This script must be run on the filesystem just before it is made into an image. All traces of this script are removed once it's run.
Copy the following script into a file called 'expand.pl'
Code: Select all
#!/usr/bin/perl
########################################################################
# This script is used to remind users to expand the RPi's filesystem #
# The script was written on November 14, 2013 by Dean C. #
########################################################################
use utf8;
use 5.010;
use strict;
#use autodie;
use warnings;
#use diagnostics;
use File::Copy;
my $script = '/home/pi/expand_fs';
my $filenew = '/home/pi/.profile';
my $fileold = "${filenew}.old";
copy($filenew, $fileold);
open (DATA1, '>>', $filenew);
print DATA1 "$script\n";
close DATA1;
open (DATA2, '>', $script);
print DATA2 "#!/usr/bin/perl\n\n";
print DATA2 "use utf8\;\n";
print DATA2 "use 5.010\;\n";
print DATA2 "use strict\;\n";
print DATA2 "#use autodie\;\n";
print DATA2 "use warnings\;\n";
print DATA2 "#use diagnostics\;\n";
print DATA2 "use File::Copy\;\n\n";
print DATA2 "move('$fileold', '$filenew')\;\n";
print DATA2 "unlink \$0\;\n\n";
print DATA2 "exec ('sudo /usr/bin/raspi-config')\;";
close DATA2;
chmod 0755, $script;
unlink $0;
exit 0;
Code: Select all
perl ./expand.pl
I have only tested this script with a RPi booting to the command line. I have not done any testing on RPi's booting to a gui.