Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
5aef9266
Unverified
Commit
5aef9266
authored
Sep 10, 2018
by
neil
Committed by
GitHub
Sep 10, 2018
Browse files
Merge pull request #1833 from cbrandel/master
use perl instead of iconv, if iconv is not available
parents
56d6079c
80b40c02
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/fritzbox.sh
View file @
5aef9266
...
@@ -28,8 +28,10 @@ fritzbox_deploy() {
...
@@ -28,8 +28,10 @@ fritzbox_deploy() {
_debug _cfullchain
"
$_cfullchain
"
_debug _cfullchain
"
$_cfullchain
"
if
!
_exists iconv
;
then
if
!
_exists iconv
;
then
_err
"iconv not found"
if
!
_exists perl
;
then
return
1
_err
"iconv or perl not found"
return
1
fi
fi
fi
_fritzbox_username
=
"
${
DEPLOY_FRITZBOX_USERNAME
}
"
_fritzbox_username
=
"
${
DEPLOY_FRITZBOX_USERNAME
}
"
...
@@ -61,7 +63,11 @@ fritzbox_deploy() {
...
@@ -61,7 +63,11 @@ fritzbox_deploy() {
_info
"Log in to the FRITZ!Box"
_info
"Log in to the FRITZ!Box"
_fritzbox_challenge
=
"
$(
_get
"
${
_fritzbox_url
}
/login_sid.lua"
|
sed
-e
's/^.*<Challenge>//'
-e
's/<\/Challenge>.*$//'
)
"
_fritzbox_challenge
=
"
$(
_get
"
${
_fritzbox_url
}
/login_sid.lua"
|
sed
-e
's/^.*<Challenge>//'
-e
's/<\/Challenge>.*$//'
)
"
_fritzbox_hash
=
"
$(
printf
"%s-%s"
"
${
_fritzbox_challenge
}
"
"
${
_fritzbox_password
}
"
| iconv
-f
ASCII
-t
UTF16LE |
md5sum
|
awk
'{print $1}'
)
"
if
_exists iconv
;
then
_fritzbox_hash
=
"
$(
printf
"%s-%s"
"
${
_fritzbox_challenge
}
"
"
${
_fritzbox_password
}
"
| iconv
-f
ASCII
-t
UTF16LE |
md5sum
|
awk
'{print $1}'
)
"
else
_fritzbox_hash
=
"
$(
printf
"%s-%s"
"
${
_fritzbox_challenge
}
"
"
${
_fritzbox_password
}
"
| perl
-p
-e
'use Encode qw/encode/; print encode("UTF-16LE","$_"); $_="";'
|
md5sum
|
awk
'{print $1}'
)
"
fi
_fritzbox_sid
=
"
$(
_get
"
${
_fritzbox_url
}
/login_sid.lua?sid=0000000000000000&username=
${
_fritzbox_username
}
&response=
${
_fritzbox_challenge
}
-
${
_fritzbox_hash
}
"
|
sed
-e
's/^.*<SID>//'
-e
's/<\/SID>.*$//'
)
"
_fritzbox_sid
=
"
$(
_get
"
${
_fritzbox_url
}
/login_sid.lua?sid=0000000000000000&username=
${
_fritzbox_username
}
&response=
${
_fritzbox_challenge
}
-
${
_fritzbox_hash
}
"
|
sed
-e
's/^.*<SID>//'
-e
's/<\/SID>.*$//'
)
"
if
[
-z
"
${
_fritzbox_sid
}
"
]
||
[
"
${
_fritzbox_sid
}
"
=
"0000000000000000"
]
;
then
if
[
-z
"
${
_fritzbox_sid
}
"
]
||
[
"
${
_fritzbox_sid
}
"
=
"0000000000000000"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment