I tested it on Debian and it works natively. On pfSense 2.0.1, I encountered a few small issues. That's why I will detail here how I resolved them.
Installation
Prerequisites
You'll need bash and wget to run the script that follows. On most distributions, there are no issues as they are already installed. But on minimal or embedded versions, this can cause problems. I will explain how to proceed on pfSense.
If you encounter problems because the repository no longer exists, take the one closest to your version and upload the files to your machine (pfSense for example):
#!/bin/bash# Description : Script for rebooting the FreeBox# from the command line.# Author : FHH <fhh@admin-linux.fr># $Id: freebox,v 1.6 2011/08/28 22:59:56 fhh Exp $# Global script variables:USERNAME="freebox";URL="http://mafreebox.freebox.fr";WORKING_DIRECTORY="${HOME}/.freebox";CONFIG_FILE="${WORKING_DIRECTORY}/config";TMP_DIRECTORY="${WORKING_DIRECTORY}/tmp";COOKIES="cookies";FREE_LOGIN_SCRIPT="/login.php";FREE_REBOOT_CGI="/system.cgi";WGET_OPTS="-T1 -t1 -qO /dev/null";# usage : Display helpusage(){echo-e"$0 <options> [command]\n";echo"Options";echo" -h : Display this help message.";echo" -p <pass> : Specify the FreeBox password.";echo;echo"Commands";echo" restart : Restart the freebox.";echo" savepass : Save the password.";echo;echo"In case of malfunction, check your ";echo"FreeBox password and/or the file \"~/.freebox/config\".";}# Script exit function:die(){echo$@>&2;exit1;}# Authentication function on the FreeBoxauth(){# Authentication and cookie registration:wget${WGET_OPTS}--save-cookies"${TMP_DIRECTORY}/${COOKIES}"--post-data"login=${USERNAME}&passwd=${password}""${URL}/${FREE_LOGIN_SCRIPT}";# If the cookie is not downloaded, authentication failed:[-e"${TMP_DIRECTORY}/${COOKIES}"]||die"> Authentication failure. Check the password.";[!-z"$(sed-e's/[[:blank:]]//g'-e'/^#\|^$/d'"${TMP_DIRECTORY}/${COOKIES}")"]||die"> Authentication failed. Check the password.";}# Password input functionaskpwd(){cpt=0;while[-z"${password}"];do((${cpt}>=3))&&die"> You must provide your password. Stop!";((cpt=cpt+1));read-sp"Password: "password;echo;done}init(){[!-d"${WORKING_DIRECTORY}"]&&{mkdir"${WORKING_DIRECTORY}"||die"> Unable to create \"${WORKING_DIRECTORY}\"";}[!-d"${TMP_DIRECTORY}"]&&{mkdir"${TMP_DIRECTORY}"||die"> Unable to create \"${TMP_DIRECTORY}\"";}[-e"${TMP_DIRECTORY}/${COOKIES}"]&&rm"${TMP_DIRECTORY}/${COOKIES}";}connection(){wget${WGET_OPTS}${URL};case$?in4)die"> Problem accessing the Freebox. Try to connect manually";;5)die"> SSL problem. Try to connect manually";;esac}cleancook(){# Cleanup of the cookie:[-e"${TMP_DIRECTORY}/${COOKIES}"]&&rm"${TMP_DIRECTORY}/${COOKIES}";}# Function to restart the FreeBoxrestart(){init;[-z"${password}"-a-r"${CONFIG_FILE}"]&&.${CONFIG_FILE};connection;askpwd;auth;# Restart the freebox:wget${WGET_OPTS}--load-cookies"${TMP_DIRECTORY}/${COOKIES}"--post-data'method=system.reboot&redirect_after=/reboot.php&timeout=1'-p"${URL}/${FREE_REBOOT_CGI}";cleancook;}savepass(){init;askpwd;auth;echo"password=${password}">"${CONFIG_FILE}";chmod0600"${CONFIG_FILE}"cleancook;}# Main program:(($#>0))||{usage;exit0;}whilegetopts":p:h"opt;docase${opt}inp)password=${OPTARG};;h)usage;exit0;;:)echo-e"> Option -$OPTARG requires an argument.\n";usage;exit1;;*)echo-e"> Invalid option \"-$OPTARG\".\n";usage;exit1;;esacdoneshift$((OPTIND-1))(($#>1))&&{echo-e"> Only one command at a time.\n";usage;exit1;};(($#<1))&&{echo-e"> No command specified.\n";usage;exit1;};case$1inrestart)restart;;savepass)savepass;;*)echo-e"> $1 : Unknown command!\n";usage;exit1;;esac